summaryrefslogtreecommitdiffstats
path: root/third_party/rust/jsparagus-json-log
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/jsparagus-json-log
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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)*)
+ );
+ };
+}