mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 11:50:38 +00:00
refactor: change logging level for mysql error log (#1938)
* refactor: change logging level for mysql error log * Update src/common/telemetry/Cargo.toml Co-authored-by: LFC <bayinamine@gmail.com> --------- Co-authored-by: LFC <bayinamine@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ opentelemetry-jaeger = { version = "0.16", features = ["rt-tokio"] }
|
||||
parking_lot = { version = "0.12", features = [
|
||||
"deadlock_detection",
|
||||
], optional = true }
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
tokio.workspace = true
|
||||
tracing = "0.1"
|
||||
tracing-appender = "0.2"
|
||||
|
||||
@@ -140,6 +140,50 @@ macro_rules! warn {
|
||||
$crate::log!(target: $target, $crate::logging::Level::WARN, $($arg)+)
|
||||
};
|
||||
|
||||
// warn!(e; "a {} event", "log")
|
||||
($e:expr; $($arg:tt)+) => ({
|
||||
use std::error::Error;
|
||||
use $crate::common_error::ext::ErrorExt;
|
||||
match ($e.source(), $e.location_opt()) {
|
||||
(Some(source), Some(location)) => {
|
||||
$crate::log!(
|
||||
$crate::logging::Level::WARN,
|
||||
err.msg = %$e,
|
||||
err.code = %$e.status_code(),
|
||||
err.source = source,
|
||||
err.location = %location,
|
||||
$($arg)+
|
||||
)
|
||||
},
|
||||
(Some(source), None) => {
|
||||
$crate::log!(
|
||||
$crate::logging::Level::WARN,
|
||||
err.msg = %$e,
|
||||
err.code = %$e.status_code(),
|
||||
err.source = source,
|
||||
$($arg)+
|
||||
)
|
||||
},
|
||||
(None, Some(location)) => {
|
||||
$crate::log!(
|
||||
$crate::logging::Level::WARN,
|
||||
err.msg = %$e,
|
||||
err.code = %$e.status_code(),
|
||||
err.location = %location,
|
||||
$($arg)+
|
||||
)
|
||||
},
|
||||
(None, None) => {
|
||||
$crate::log!(
|
||||
$crate::logging::Level::WARN,
|
||||
err.msg = %$e,
|
||||
err.code = %$e.status_code(),
|
||||
$($arg)+
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// warn!("a {} event", "log")
|
||||
($($arg:tt)+) => {
|
||||
$crate::log!($crate::logging::Level::WARN, $($arg)+)
|
||||
|
||||
Reference in New Issue
Block a user