Pure MoonBit structured logging and tracing library with safe formatters, replay, query, and retention utilities.
fn BatchLogger::debug(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLoggerfn BatchLogger::error(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLoggerfn BatchLogger::info(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLoggerfn BatchLogger::log(self : BatchLogger, lvl : Level, msg : String, fields : Array[(String, String)]) -> BatchLoggerfn BatchLogger::trace(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLoggerfn BatchLogger::warn(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLoggerpub(all) struct BurstSampler {
max_burst : Int
sustained_rate : Int
window_size : Int
bucket : Int
last_refill : Int
}pub(all) struct ConsoleAppender {
use_json : Bool
}pub(all) struct CorrelationId {
id : String
sequence : Int
}pub(all) struct Counter {
name : String
value : Int
}pub(all) struct FieldFilter {
key : String
value : String
}fn LogContext::merge(self : LogContext, fields : Array[(String, String)]) -> Array[(String, String)]pub(all) struct LogRouter {
memory_all : MemoryAppender
memory_errors : MemoryAppender
logger : Logger
}pub(all) struct Logger {
level : Level
has_console : Bool
console_json : Bool
memory : MemoryAppender
seq : Int
context : LogContext
console_json_enabled : Bool
}fn Logger::apply_retention(self : Logger, policy : RetentionPolicy, current_timestamp : Int) -> RetentionResultpub(all) struct MessageFilter {
substring : String
}pub(all) struct PercentSampler {
rate : Int
counter : Int
}fn RequestContext::error(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContextfn RequestContext::info(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContextfn RequestContext::warn(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContextfn RequestContext::with_field(self : RequestContext, key : String, value : String) -> RequestContextfn RetentionPolicy::apply(self : RetentionPolicy, records : Array[LogRecord], current_timestamp : Int) -> RetentionResultpub(all) struct RotationPolicy {
max_entries : Int
rotation_count : Int
current_index : Int
}pub(all) struct SizeRotationPolicy {
max_bytes : Int
current_bytes : Int
rotation_count : Int
}fn TaggedLogger::error(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLoggerfn TaggedLogger::info(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLoggerfn TaggedLogger::warn(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLoggerpub(all) struct ThroughputCounter {
name : String
total : Int
first_ts : Int
last_ts : Int
}pub(all) struct TimeRotationPolicy {
max_ticks : Int
last_rotate_tick : Int
rotation_count : Int
}fn TimeRotationPolicy::check(self : TimeRotationPolicy, current_tick : Int) -> (TimeRotationPolicy, Bool)pub(all) struct Timer {
name : String
start_seq : Int
}fn typed_fields_to_pairs(fields : Array[TypedField], idx : Int, result : Array[(String, String)]) -> Array[(String, String)]fn with_correlation(fields : Array[(String, String)], corr : CorrelationId, key : String) -> Array[(String, String)]Pure MoonBit structured logging and tracing library with safe formatters, replay, query, and retention utilities.