| 1 | /* |
| 2 | * Copyright (c) 2023. |
| 3 | * |
| 4 | * This software is free software; |
| 5 | * |
| 6 | * You can redistribute it or modify it under terms of the MIT, Apache License or Zlib license |
| 7 | */ |
| 8 | |
| 9 | // #[macro_export] is required to make macros works across crates |
| 10 | // but it always put the macro in the crate root. |
| 11 | // #[doc(hidden)] + "pub use" is a workaround to namespace a macro. |
| 12 | pub use crate::{ |
| 13 | __debug as debug, __error as error, __info as info, __log_enabled as log_enabled, |
| 14 | __trace as trace, __warn as warn |
| 15 | }; |
| 16 | |
| 17 | #[repr (usize)] |
| 18 | #[derive (Copy, Clone, Eq, PartialEq, Debug, Hash)] |
| 19 | pub enum Level { |
| 20 | Error = 1, |
| 21 | Warn, |
| 22 | Info, |
| 23 | Debug, |
| 24 | Trace |
| 25 | } |
| 26 | |
| 27 | #[doc (hidden)] |
| 28 | #[macro_export ] |
| 29 | macro_rules! __log_enabled { |
| 30 | ($lvl:expr) => {{ |
| 31 | let _ = $lvl; |
| 32 | false |
| 33 | }}; |
| 34 | } |
| 35 | |
| 36 | #[doc (hidden)] |
| 37 | #[macro_export ] |
| 38 | macro_rules! __error { |
| 39 | ($($arg:tt)+) => { |
| 40 | #[cfg(feature = "std" )] |
| 41 | { |
| 42 | //eprintln!($($arg)+); |
| 43 | } |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | #[doc (hidden)] |
| 48 | #[macro_export ] |
| 49 | macro_rules! __warn { |
| 50 | ($($arg:tt)+) => { |
| 51 | #[cfg(feature = "std" )] |
| 52 | { |
| 53 | //eprintln!($($arg)+); |
| 54 | } |
| 55 | }; |
| 56 | } |
| 57 | |
| 58 | #[doc (hidden)] |
| 59 | #[macro_export ] |
| 60 | macro_rules! __info { |
| 61 | ($($arg:tt)+) => {}; |
| 62 | } |
| 63 | |
| 64 | #[doc (hidden)] |
| 65 | #[macro_export ] |
| 66 | macro_rules! __debug { |
| 67 | ($($arg:tt)+) => {}; |
| 68 | } |
| 69 | |
| 70 | #[doc (hidden)] |
| 71 | #[macro_export ] |
| 72 | macro_rules! __trace { |
| 73 | ($($arg:tt)+) => {}; |
| 74 | } |
| 75 | |