Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move logging into an independent crate
- Loading branch information
danielsanchezq
committed
Aug 3, 2020
1 parent
15dfd76
commit 7a8d3c3
Showing
12 changed files
with
86 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
[package] | ||
name = "logging-lib" | ||
version = "0.1.0" | ||
authors = ["danielsanchezq <daniel.sanchez@iohk.io>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
chrono = { version = "0.4.13", features = ["serde"] } | ||
log = "0.4.11" | ||
serde = "1.0.114" | ||
serde_json = "1.0.57" | ||
simplelog = "0.8.0" |
File renamed without changes.
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,3 @@ | ||
pub mod config; | ||
pub mod messages; | ||
mod methods; |
File renamed without changes.
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 @@ | ||
#[macro_export] | ||
macro_rules! log { | ||
($lvl:expr, $($arg:tt)+) => ( | ||
let formatted_message = format_args!($($arg)+).to_string(); | ||
let level = $lvl; | ||
$crate::messages::LogMessageBuilder::default().with_level(level).with_message(formatted_message).build().log(); | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! error { | ||
($($arg:tt)+) => ( | ||
$crate::log!(log::Level::Error, $($arg)+) | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! warn { | ||
($($arg:tt)+) => ( | ||
$crate::log!(log::Level::Warn, $($arg)+) | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! info { | ||
($($arg:tt)+) => ( | ||
$crate::log!(log::Level::Info, $($arg)+) | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! debug { | ||
($($arg:tt)+) => ( | ||
$crate::log!(log::Level::Debug, $($arg)+) | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! trace { | ||
($($arg:tt)+) => ( | ||
$crate::log!($log::Level::Trace, $($arg)+) | ||
) | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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