summaryrefslogtreecommitdiffstats
path: root/third_party/rust/jsparagus-json-log
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/jsparagus-json-log')
-rw-r--r--third_party/rust/jsparagus-json-log/.cargo-checksum.json1
-rw-r--r--third_party/rust/jsparagus-json-log/Cargo.toml35
-rw-r--r--third_party/rust/jsparagus-json-log/src/lib.rs41
3 files changed, 77 insertions, 0 deletions
diff --git a/third_party/rust/jsparagus-json-log/.cargo-checksum.json b/third_party/rust/jsparagus-json-log/.cargo-checksum.json
new file mode 100644
index 0000000000..61ece706d4
--- /dev/null
+++ b/third_party/rust/jsparagus-json-log/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"215b06c56addd1cb805cf47e588d52ba7b0cb4bc3216a7ab3164b0d362d93b78","src/lib.rs":"09352799b74833de10a95ce1097fb0d1a3f3474468f61dc9adeb58705508e632"},"package":null} \ No newline at end of file
diff --git a/third_party/rust/jsparagus-json-log/Cargo.toml b/third_party/rust/jsparagus-json-log/Cargo.toml
new file mode 100644
index 0000000000..b78e29137c
--- /dev/null
+++ b/third_party/rust/jsparagus-json-log/Cargo.toml
@@ -0,0 +1,35 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "jsparagus-json-log"
+version = "0.1.0"
+authors = ["The jsparagus Project Developers"]
+license = "MIT/Apache-2.0"
+
+[dependencies.log]
+version = "0.4.0"
+features = [
+ "max_level_debug",
+ "release_max_level_warn",
+]
+optional = true
+
+[dependencies.serde_json]
+version = "1.0"
+optional = true
+
+[features]
+logging = [
+ "log",
+ "serde_json",
+]
diff --git a/third_party/rust/jsparagus-json-log/src/lib.rs b/third_party/rust/jsparagus-json-log/src/lib.rs
new file mode 100644
index 0000000000..ed818566e5
--- /dev/null
+++ b/third_party/rust/jsparagus-json-log/src/lib.rs
@@ -0,0 +1,41 @@
+//! Provides a debug/trace output with json format.
+//! This is disabled by default, and can be enabled by "logging" feature.
+
+#[cfg(feature = "logging")]
+pub use log::{debug, trace};
+#[cfg(feature = "logging")]
+pub use serde_json::json;
+
+#[cfg(not(feature = "logging"))]
+#[macro_export]
+macro_rules! json_debug {
+ ($($t:tt)*) => {};
+}
+
+#[cfg(feature = "logging")]
+#[macro_export(local_inner_macros)]
+macro_rules! json_debug {
+ ($($t:tt)*) => {
+ debug!(
+ "{}",
+ json!($($t)*)
+ );
+ };
+}
+
+#[cfg(not(feature = "logging"))]
+#[macro_export]
+macro_rules! json_trace {
+ ($($t:tt)*) => {};
+}
+
+#[cfg(feature = "logging")]
+#[macro_export(local_inner_macros)]
+macro_rules! json_trace {
+ ($($t:tt)*) => {
+ trace!(
+ "{}",
+ json!($($t)*)
+ );
+ };
+}