1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/// Log a message with a given level
#[macro_export(local_inner_macros)]
macro_rules! log {
	($lvl:expr, $fmt:expr) => ($crate::logcrate::log!(
		target: __log_target!(),
		$lvl,
		core::concat!("{}: ", $fmt),
		slos_helpers::function!()
	));

	($lvl:expr, $fmt:expr, $($arg:tt)+) => ($crate::logcrate::log!(
		target: __log_target!(),
		$lvl,
		core::concat!("{}: ", $fmt),
		slos_helpers::function!(),
		$($arg)+
	))
}

/// Log an error message
#[macro_export(local_inner_macros)]
macro_rules! error {
	($($arg:tt)+) => (log!($crate::logcrate::Level::Error, $($arg)+))
}

/// Log a warning message
#[macro_export(local_inner_macros)]
macro_rules! warn {
	($($arg:tt)+) => (log!($crate::logcrate::Level::Warn, $($arg)+))
}

/// Log an info message
#[macro_export(local_inner_macros)]
macro_rules! info {
	($($arg:tt)+) => (log!($crate::logcrate::Level::Info, $($arg)+))
}

/// Log a debug message
#[macro_export(local_inner_macros)]
macro_rules! debug {
	($($arg:tt)+) => (log!($crate::logcrate::Level::Debug, $($arg)+))
}

/// Log a trace message
#[macro_export(local_inner_macros)]
macro_rules! trace {
	($($arg:tt)+) => (log!($crate::logcrate::Level::Trace, $($arg)+))
}

#[doc(hidden)]
#[macro_export]
macro_rules! __log_target {
	() => {
		module_path!()
	};
}