1#![feature(min_specialization, thread_local, core_intrinsics)]
2#![allow(internal_features)]
3
4pub mod builder;
5pub mod encode;
6pub mod header;
7pub mod logger;
8pub mod number_format;
9pub mod output;
10pub mod poller;
11pub mod spsc_queue;
12pub mod thread_buffer;
13pub mod timestamp_counter;
14
15pub use builder::{FlashLogBuilder, FlashLogGuard, builder};
17#[doc(hidden)]
19pub use encode::{
20 ENCODED_SIZE_DYNAMIC, EncodeBinary, EncodeConstBinaryFormat, EncodeConstDefaultFormat,
21 EncodeConstFloatFormat, EncodeConstLowerHexFormat, EncodeConstOctalFormat,
22 EncodeConstUpperHexFormat, EncodeLowerHex, EncodeOctal, EncodeUpperHex, FORMAT_ALIGN_CENTER,
23 FORMAT_ALIGN_LEFT, FORMAT_ALIGN_NONE, FORMAT_ALIGN_RIGHT, FORMAT_PRECISION_NONE, VecWriter,
24 append_display_const_default, append_display_with_spec,
25};
26pub use encode::{Encode, EncodeFast};
27#[doc(hidden)]
28pub use header::{
29 HeaderDateCache, StaticHeader, StaticHeaderWriteFn, append_header_nanoseconds,
30 append_header_time,
31};
32#[doc(hidden)]
33pub use logger::{DecodeFn, StaticInfo, check_level, set_static_header};
34pub use logger::{
35 QueueFullCallback, QueueFullPolicy, flush_on, poll, queue_full_count, reset_queue_full_count,
36 set_flush_buffer_size, set_flush_delay, set_header_pattern, set_level, set_log_file,
37 set_log_file_with_rotation, set_output_writer, set_queue_full_callback, set_queue_full_policy,
38 start_polling_thread, start_polling_thread_on_core, stop_polling_thread,
39};
40pub use output::RotationConfig;
41#[doc(hidden)]
42pub use spsc_queue::{
43 PAYLOAD_ARGS_OFFSET, PAYLOAD_HEADER_SIZE, PAYLOAD_INFO_OFFSET, PAYLOAD_TIMESTAMP_OFFSET,
44};
45#[doc(hidden)]
46pub use thread_buffer::alloc_message;
47pub use thread_buffer::set_thread_name;
48#[doc(hidden)]
49pub use timestamp_counter::TimestampCounter;
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
53#[repr(u8)]
54pub enum Level {
55 DBG = 0,
57 INF = 1,
59 WRN = 2,
61 ERR = 3,
63 OFF = 4,
65}
66
67impl Level {
68 #[inline]
70 pub fn as_bytes(&self) -> &'static [u8] {
71 match self {
72 Level::DBG => b"DBG",
73 Level::INF => b"INF",
74 Level::WRN => b"WRN",
75 Level::ERR => b"ERR",
76 Level::OFF => b"OFF",
77 }
78 }
79}
80
81#[inline]
83pub fn level_from_u8(value: u8) -> Level {
84 match value {
85 0 => Level::DBG,
86 1 => Level::INF,
87 2 => Level::WRN,
88 3 => Level::ERR,
89 _ => Level::OFF,
90 }
91}
92
93pub const DBG: Level = Level::DBG;
95pub const INF: Level = Level::INF;
97pub const WRN: Level = Level::WRN;
99pub const ERR: Level = Level::ERR;
101pub const OFF: Level = Level::OFF;
103
104pub const DEBUG: Level = Level::DBG;
106pub const INFO: Level = Level::INF;
108pub const WARN: Level = Level::WRN;
110pub const ERROR: Level = Level::ERR;