-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
80 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ members = [ | |
|
||
[package] | ||
name = "fast_log" | ||
version = "1.4.12" | ||
version = "1.4.13" | ||
description = "Rust async log High-performance asynchronous logging" | ||
readme = "Readme.md" | ||
authors = ["ce <[email protected]>"] | ||
|
@@ -15,9 +15,12 @@ license = "MIT" | |
|
||
|
||
[features] | ||
default = ["zip","cogo"] | ||
default = ["zip","runtime_cogo"] | ||
gzip = ["flate2"] | ||
|
||
runtime_thread = [] | ||
runtime_cogo = ["cogo"] | ||
|
||
[dependencies] | ||
chrono = { version = "0.4", features = ["serde"] } | ||
lazy_static = "1.4.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use std::time::Duration; | ||
|
||
/// if use cogo runtime | ||
#[cfg(feature = "cogo")] | ||
pub type Receiver<T> = cogo::std::sync::mpmc::Receiver<T>; | ||
#[cfg(feature = "cogo")] | ||
pub type Sender<T> = cogo::std::sync::mpmc::Sender<T>; | ||
|
||
#[cfg(feature = "cogo")] | ||
pub fn chan<T>() -> (Sender<T>, Receiver<T>) { | ||
cogo::chan!() | ||
} | ||
|
||
#[cfg(feature = "cogo")] | ||
pub fn sleep(d: Duration) { | ||
cogo::coroutine::sleep(d) | ||
} | ||
|
||
#[cfg(feature = "cogo")] | ||
pub fn spawn<F>(f: F) where F: FnOnce() + std::marker::Send + 'static { | ||
cogo::go!(cogo::coroutine::Builder::new().stack_size(2*0x1000),f); | ||
} | ||
|
||
/// if not cogo | ||
#[cfg(not(feature = "cogo"))] | ||
pub type Receiver<T> = crossbeam::channel::Receiver<T>; | ||
#[cfg(not(feature = "cogo"))] | ||
pub type Sender<T> = crossbeam::channel::Sender<T>; | ||
|
||
#[cfg(not(feature = "cogo"))] | ||
pub fn chan<T>() -> (Sender<T>, Receiver<T>) { | ||
cogo::chan!() | ||
} | ||
|
||
#[cfg(not(feature = "cogo"))] | ||
pub fn sleep(d: Duration) { | ||
std::thread::sleep(d) | ||
} | ||
|
||
#[cfg(not(feature = "cogo"))] | ||
pub fn spawn<F>(f: F) where F: FnOnce() + std::marker::Send + 'static { | ||
std::thread::spawn(f); | ||
} |