Sign in

    MoonLogTrace

    Pure MoonBit structured logging and tracing library with safe formatters, replay, query, and retention utilities.

    logging
    tracing
    structured-logging
    span
    debug
    syslog
    metrics
    pipeline
    Download zip
    Version
    0.1.4
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    38
    # CCllff-jpg/MoonLogTrace

    Pure MoonBit structured logging and lightweight tracing library with bounded in-memory appenders, replay, safe string formatters, structured queries, retention policies, contexts, spans, and test utilities.

    Install with moon add CCllff-jpg/MoonLogTrace@0.1.3. See README.md for usage, quality gates, and documented limitations.

    AlertManager

    pub(all) struct AlertManager {
    rules : Array[AlertRule]
    }

    AlertManager::add_rule

    fn AlertManager::add_rule(self : AlertManager, rule : AlertRule) -> AlertManager

    AlertManager::check_all

    fn AlertManager::check_all(self : AlertManager, logger : Logger) -> (AlertManager, Array[String])

    AlertManager::new

    AlertRule

    pub(all) struct AlertRule {
    name : String
    min_level : Level
    max_count : Int
    window_size : Int
    }

    AlertRule::evaluate

    fn AlertRule::evaluate(self : AlertRule, logger : Logger) -> Bool

    AlertRule::new

    fn AlertRule::new(name : String, min_level : Level, max_count : Int, window_size : Int) -> AlertRule

    AllowListFilter

    pub(all) struct AllowListFilter {
    allowed : Array[Level]
    }

    AllowListFilter::check

    fn AllowListFilter::check(self : AllowListFilter, level : Level) -> Bool

    AllowListFilter::new

    BatchLogger

    pub(all) struct BatchLogger {
    logger : Logger
    buffer : Array[LogRecord]
    batch_size : Int
    }

    BatchLogger::debug

    fn BatchLogger::debug(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BatchLogger::error

    fn BatchLogger::error(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BatchLogger::flush

    fn BatchLogger::flush(self : BatchLogger) -> BatchLogger

    BatchLogger::info

    fn BatchLogger::info(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BatchLogger::log

    fn BatchLogger::log(self : BatchLogger, lvl : Level, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BatchLogger::new

    fn BatchLogger::new(logger : Logger, batch_size : Int) -> BatchLogger

    BatchLogger::pending

    fn BatchLogger::pending(self : BatchLogger) -> Int

    BatchLogger::trace

    fn BatchLogger::trace(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BatchLogger::warn

    fn BatchLogger::warn(self : BatchLogger, msg : String, fields : Array[(String, String)]) -> BatchLogger

    BurstSampler

    pub(all) struct BurstSampler {
    max_burst : Int
    sustained_rate : Int
    window_size : Int
    bucket : Int
    last_refill : Int
    }

    BurstSampler::allow

    fn BurstSampler::allow(self : BurstSampler, tick : Int) -> (BurstSampler, Bool)

    BurstSampler::new

    fn BurstSampler::new(max_burst : Int, sustained_rate : Int, window_size : Int) -> BurstSampler

    ConsoleAppender

    pub(all) struct ConsoleAppender {
    use_json : Bool
    }

    ConsoleAppender::append

    fn ConsoleAppender::append(self : ConsoleAppender, record : LogRecord) -> String

    ConsoleAppender::json

    ConsoleAppender::new

    CorrelationId

    pub(all) struct CorrelationId {
    id : String
    sequence : Int
    }

    CorrelationId::generate

    fn CorrelationId::generate(prefix : String, seq : Int) -> CorrelationId

    CorrelationId::new

    fn CorrelationId::new(id : String) -> CorrelationId

    CorrelationId::next

    CorrelationId::to_field

    fn CorrelationId::to_field(self : CorrelationId, key : String) -> (String, String)

    Counter

    pub(all) struct Counter {
    name : String
    value : Int
    }

    Counter::add

    fn Counter::add(self : Counter, n : Int) -> Counter

    Counter::increment

    fn Counter::increment(self : Counter) -> Counter

    Counter::new

    fn Counter::new(name : String) -> Counter

    Counter::read

    fn Counter::read(self : Counter) -> Int

    DenyListFilter

    pub(all) struct DenyListFilter {
    denied : Array[Level]
    }

    DenyListFilter::check

    fn DenyListFilter::check(self : DenyListFilter, level : Level) -> Bool

    DenyListFilter::new

    EventMeter

    pub(all) struct EventMeter {
    name : String
    events : Array[Int]
    window_size : Int
    }

    EventMeter::count

    fn EventMeter::count(self : EventMeter) -> Int

    EventMeter::new

    fn EventMeter::new(name : String, window_size : Int) -> EventMeter

    EventMeter::rate

    fn EventMeter::rate(self : EventMeter) -> Int

    EventMeter::record

    fn EventMeter::record(self : EventMeter, ts : Int) -> EventMeter

    FieldFilter

    pub(all) struct FieldFilter {
    key : String
    value : String
    }

    FieldFilter::check

    fn FieldFilter::check(self : FieldFilter, record : LogRecord) -> Bool

    FieldFilter::new

    fn FieldFilter::new(key : String, value : String) -> FieldFilter

    FieldValue

    pub(all) enum FieldValue {
    Str(String)
    IntVal(Int)
    FloatVal(Float)
    BoolVal(Bool)
    }

    Histogram

    pub(all) struct Histogram {
    name : String
    values : Array[Int]
    }

    Histogram::avg

    fn Histogram::avg(self : Histogram) -> Int

    Histogram::count

    fn Histogram::count(self : Histogram) -> Int

    Histogram::max_val

    fn Histogram::max_val(self : Histogram) -> Int

    Histogram::min_val

    fn Histogram::min_val(self : Histogram) -> Int

    Histogram::new

    fn Histogram::new(name : String) -> Histogram

    Histogram::record

    fn Histogram::record(self : Histogram, value : Int) -> Histogram

    Histogram::sum

    fn Histogram::sum(self : Histogram) -> Int

    Level

    pub(all) enum Level {
    TRACE
    DEBUG
    INFO
    WARN
    ERROR
    }

    LevelFilter

    pub(all) struct LevelFilter {
    threshold : Level
    }

    LevelFilter::check

    fn LevelFilter::check(self : LevelFilter, level : Level) -> Bool

    LevelFilter::new

    fn LevelFilter::new(threshold : Level) -> LevelFilter

    LogContext

    pub(all) struct LogContext {
    pairs : Array[(String, String)]
    }

    LogContext::add

    fn LogContext::add(self : LogContext, key : String, value : String) -> LogContext

    LogContext::merge

    fn LogContext::merge(self : LogContext, fields : Array[(String, String)]) -> Array[(String, String)]

    LogContext::new

    fn LogContext::new() -> LogContext

    LogQuery

    pub(all) struct LogQuery {
    minimum_level : Level?
    maximum_level : Level?
    message_fragment : String?
    required_field_key : String?
    required_field_value : String?
    start_timestamp : Int?
    end_timestamp : Int?
    result_limit : Int?
    }

    LogQuery::count

    fn LogQuery::count(self : LogQuery, records : Array[LogRecord]) -> Int

    LogQuery::execute

    fn LogQuery::execute(self : LogQuery, records : Array[LogRecord]) -> Array[LogRecord]

    LogQuery::field_equals

    fn LogQuery::field_equals(self : LogQuery, key : String, value : String) -> LogQuery

    LogQuery::field_exists

    fn LogQuery::field_exists(self : LogQuery, key : String) -> LogQuery

    LogQuery::first

    fn LogQuery::first(self : LogQuery, records : Array[LogRecord]) -> LogRecord?

    LogQuery::limit

    fn LogQuery::limit(self : LogQuery, count : Int) -> LogQuery

    LogQuery::matches

    fn LogQuery::matches(self : LogQuery, record : LogRecord) -> Bool

    LogQuery::max_level

    fn LogQuery::max_level(self : LogQuery, level : Level) -> LogQuery

    LogQuery::message_contains

    fn LogQuery::message_contains(self : LogQuery, fragment : String) -> LogQuery

    LogQuery::min_level

    fn LogQuery::min_level(self : LogQuery, level : Level) -> LogQuery

    LogQuery::new

    fn LogQuery::new() -> LogQuery

    LogQuery::since

    fn LogQuery::since(self : LogQuery, timestamp : Int) -> LogQuery

    LogQuery::until

    fn LogQuery::until(self : LogQuery, timestamp : Int) -> LogQuery

    LogRecord

    pub(all) struct LogRecord {
    level : Level
    message : String
    fields : Array[(String, String)]
    timestamp : Int
    }

    LogRecord::copy

    fn LogRecord::copy(self : LogRecord) -> LogRecord

    LogRecord::new

    fn LogRecord::new(level : Level, message : String, fields : Array[(String, String)], timestamp : Int) -> LogRecord

    LogReplay

    pub(all) struct LogReplay {
    records : Array[LogRecord]
    position : Int
    }

    LogReplay::current_position

    fn LogReplay::current_position(self : LogReplay) -> Int

    LogReplay::from_logger

    fn LogReplay::from_logger(logger : Logger) -> LogReplay

    LogReplay::from_records

    fn LogReplay::from_records(records : Array[LogRecord]) -> LogReplay

    LogReplay::has_more

    fn LogReplay::has_more(self : LogReplay) -> Bool

    LogReplay::next

    fn LogReplay::next(self : LogReplay) -> (LogReplay, LogRecord)

    LogReplay::next_record

    fn LogReplay::next_record(self : LogReplay) -> (LogReplay, LogRecord?)

    LogReplay::peek

    fn LogReplay::peek(self : LogReplay) -> LogRecord?

    LogReplay::remaining

    fn LogReplay::remaining(self : LogReplay) -> Int

    LogReplay::replay_into

    fn LogReplay::replay_into(self : LogReplay, logger : Logger) -> (LogReplay, Logger)

    LogReplay::reset

    fn LogReplay::reset(self : LogReplay) -> LogReplay

    LogReplay::seek

    fn LogReplay::seek(self : LogReplay, position : Int) -> LogReplay

    LogReplay::total

    fn LogReplay::total(self : LogReplay) -> Int

    LogRouter

    pub(all) struct LogRouter {
    memory_all : MemoryAppender
    memory_errors : MemoryAppender
    logger : Logger
    }

    LogRouter::all_count

    fn LogRouter::all_count(self : LogRouter) -> Int

    LogRouter::all_logs

    fn LogRouter::all_logs(self : LogRouter) -> Array[String]

    LogRouter::dispatch

    fn LogRouter::dispatch(self : LogRouter, lvl : Level, msg : String, fields : Array[(String, String)]) -> LogRouter

    LogRouter::error_count

    fn LogRouter::error_count(self : LogRouter) -> Int

    LogRouter::error_logs

    fn LogRouter::error_logs(self : LogRouter) -> Array[String]

    LogRouter::new

    fn LogRouter::new(logger : Logger) -> LogRouter

    LogSummary

    pub(all) struct LogSummary {
    total : Int
    by_level : Array[Int]
    }

    LogSummary::error_rate

    fn LogSummary::error_rate(self : LogSummary) -> Int

    LogSummary::warn_rate

    fn LogSummary::warn_rate(self : LogSummary) -> Int

    Logger

    pub(all) struct Logger {
    level : Level
    has_console : Bool
    console_json : Bool
    memory : MemoryAppender
    seq : Int
    context : LogContext
    console_json_enabled : Bool
    }

    Logger::add_context

    fn Logger::add_context(self : Logger, key : String, value : String) -> Logger

    Logger::apply_retention

    fn Logger::apply_retention(self : Logger, policy : RetentionPolicy, current_timestamp : Int) -> RetentionResult

    Logger::build

    fn Logger::build(self : Logger) -> Logger

    Logger::console

    fn Logger::console(self : Logger) -> Logger

    Logger::console_json

    fn Logger::console_json(self : Logger) -> Logger

    Logger::debug

    fn Logger::debug(self : Logger, msg : String, fields : Array[(String, String)]) -> Logger

    Logger::error

    fn Logger::error(self : Logger, msg : String, fields : Array[(String, String)]) -> Logger

    Logger::info

    fn Logger::info(self : Logger, msg : String, fields : Array[(String, String)]) -> Logger

    Logger::level

    fn Logger::level(self : Logger, l : Level) -> Logger

    Logger::log_count

    fn Logger::log_count(self : Logger) -> Int

    Logger::logs

    fn Logger::logs(self : Logger) -> Array[String]

    Logger::new

    fn Logger::new() -> Logger

    Logger::query

    fn Logger::query(self : Logger, query : LogQuery) -> Array[LogRecord]

    Logger::records

    fn Logger::records(self : Logger) -> Array[LogRecord]

    Logger::trace

    fn Logger::trace(self : Logger, msg : String, fields : Array[(String, String)]) -> Logger

    Logger::warn

    fn Logger::warn(self : Logger, msg : String, fields : Array[(String, String)]) -> Logger

    LoggerConfig

    pub(all) struct LoggerConfig {
    level : Level
    enable_console : Bool
    console_json : Bool
    context_keys : Array[String]
    context_values : Array[String]
    }

    LoggerConfig::add_context

    fn LoggerConfig::add_context(self : LoggerConfig, key : String, value : String) -> LoggerConfig

    LoggerConfig::build_logger

    fn LoggerConfig::build_logger(self : LoggerConfig) -> Logger

    LoggerConfig::enable_console

    fn LoggerConfig::enable_console(self : LoggerConfig) -> LoggerConfig

    LoggerConfig::enable_console_json

    fn LoggerConfig::enable_console_json(self : LoggerConfig) -> LoggerConfig

    LoggerConfig::new

    LoggerConfig::set_level

    fn LoggerConfig::set_level(self : LoggerConfig, l : Level) -> LoggerConfig

    MemoryAppender

    pub(all) struct MemoryAppender {
    records : Array[String]
    entries : Array[LogRecord]
    }

    MemoryAppender::append

    fn MemoryAppender::append(self : MemoryAppender, record : LogRecord) -> MemoryAppender

    MemoryAppender::count

    fn MemoryAppender::count(self : MemoryAppender) -> Int

    MemoryAppender::get_logs

    fn MemoryAppender::get_logs(self : MemoryAppender) -> Array[String]

    MemoryAppender::get_records

    fn MemoryAppender::get_records(self : MemoryAppender) -> Array[LogRecord]

    MemoryAppender::new

    MessageFilter

    pub(all) struct MessageFilter {
    substring : String
    }

    MessageFilter::check

    fn MessageFilter::check(self : MessageFilter, record : LogRecord) -> Bool

    MessageFilter::new

    fn MessageFilter::new(substring : String) -> MessageFilter

    PercentSampler

    pub(all) struct PercentSampler {
    rate : Int
    counter : Int
    }

    PercentSampler::new

    fn PercentSampler::new(rate : Int) -> PercentSampler

    PercentSampler::sample

    fn PercentSampler::sample(self : PercentSampler) -> (PercentSampler, Bool)

    Pipeline

    pub(all) struct Pipeline {
    add_field_keys : Array[String]
    add_field_values : Array[String]
    prefix_message : String
    redact_keys : Array[String]
    }

    Pipeline::add_field

    fn Pipeline::add_field(self : Pipeline, key : String, value : String) -> Pipeline

    Pipeline::apply

    fn Pipeline::apply(self : Pipeline, record : LogRecord) -> LogRecord

    Pipeline::new

    fn Pipeline::new() -> Pipeline

    Pipeline::prepend_msg

    fn Pipeline::prepend_msg(self : Pipeline, prefix : String) -> Pipeline

    Pipeline::redact

    fn Pipeline::redact(self : Pipeline, key : String) -> Pipeline

    Pipeline::transform_count

    fn Pipeline::transform_count(self : Pipeline) -> Int

    RateLimiter

    pub(all) struct RateLimiter {
    max_per_window : Int
    meter : EventMeter
    }

    RateLimiter::allow

    fn RateLimiter::allow(self : RateLimiter, ts : Int) -> (RateLimiter, Bool)

    RateLimiter::new

    fn RateLimiter::new(max_per_window : Int, window_size : Int) -> RateLimiter

    RateSampler

    pub(all) struct RateSampler {
    max_per_window : Int
    window_size : Int
    events : Array[Int]
    }

    RateSampler::allow

    fn RateSampler::allow(self : RateSampler, tick : Int) -> (RateSampler, Bool)

    RateSampler::count

    fn RateSampler::count(self : RateSampler) -> Int

    RateSampler::new

    fn RateSampler::new(max_per_window : Int, window_size : Int) -> RateSampler

    RequestContext

    pub(all) struct RequestContext {
    context : LogContext
    correlation : CorrelationId
    logger : Logger
    }

    RequestContext::error

    fn RequestContext::error(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContext

    RequestContext::finish

    fn RequestContext::finish(self : RequestContext) -> Logger

    RequestContext::info

    fn RequestContext::info(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContext

    RequestContext::new

    fn RequestContext::new(logger : Logger, request_id : String) -> RequestContext

    RequestContext::warn

    fn RequestContext::warn(self : RequestContext, msg : String, fields : Array[(String, String)]) -> RequestContext

    RequestContext::with_field

    fn RequestContext::with_field(self : RequestContext, key : String, value : String) -> RequestContext

    RetentionPolicy

    pub(all) struct RetentionPolicy {
    minimum_level : Level?
    maximum_age : Int?
    maximum_count : Int?
    }

    RetentionPolicy::apply

    fn RetentionPolicy::apply(self : RetentionPolicy, records : Array[LogRecord], current_timestamp : Int) -> RetentionResult

    RetentionPolicy::max_age

    fn RetentionPolicy::max_age(self : RetentionPolicy, age : Int) -> RetentionPolicy

    RetentionPolicy::max_count

    fn RetentionPolicy::max_count(self : RetentionPolicy, count : Int) -> RetentionPolicy

    RetentionPolicy::min_level

    fn RetentionPolicy::min_level(self : RetentionPolicy, level : Level) -> RetentionPolicy

    RetentionPolicy::new

    RetentionResult

    pub(all) struct RetentionResult {
    records : Array[LogRecord]
    dropped_by_level : Int
    dropped_by_age : Int
    dropped_by_capacity : Int
    }

    RetentionResult::dropped_count

    fn RetentionResult::dropped_count(self : RetentionResult) -> Int

    RetentionResult::get_records

    fn RetentionResult::get_records(self : RetentionResult) -> Array[LogRecord]

    RetentionResult::kept_count

    fn RetentionResult::kept_count(self : RetentionResult) -> Int

    RollingAppender

    pub(all) struct RollingAppender {
    records : Array[String]
    entries : Array[LogRecord]
    max_count : Int
    dropped_count : Int
    }

    RollingAppender::append

    RollingAppender::capacity

    fn RollingAppender::capacity(self : RollingAppender) -> Int

    RollingAppender::clear

    RollingAppender::count

    fn RollingAppender::count(self : RollingAppender) -> Int

    RollingAppender::dropped

    fn RollingAppender::dropped(self : RollingAppender) -> Int

    RollingAppender::get_logs

    fn RollingAppender::get_logs(self : RollingAppender) -> Array[String]

    RollingAppender::get_records

    fn RollingAppender::get_records(self : RollingAppender) -> Array[LogRecord]

    RollingAppender::is_full

    fn RollingAppender::is_full(self : RollingAppender) -> Bool

    RollingAppender::new

    fn RollingAppender::new(max_count : Int) -> RollingAppender

    RotationPolicy

    pub(all) struct RotationPolicy {
    max_entries : Int
    rotation_count : Int
    current_index : Int
    }

    RotationPolicy::generation

    fn RotationPolicy::generation(self : RotationPolicy) -> Int

    RotationPolicy::new

    fn RotationPolicy::new(max_entries : Int) -> RotationPolicy

    RotationPolicy::rotate

    RotationPolicy::should_rotate

    fn RotationPolicy::should_rotate(self : RotationPolicy, current_count : Int) -> Bool

    SizeRotationPolicy

    pub(all) struct SizeRotationPolicy {
    max_bytes : Int
    current_bytes : Int
    rotation_count : Int
    }

    SizeRotationPolicy::count

    fn SizeRotationPolicy::count(self : SizeRotationPolicy) -> Int

    SizeRotationPolicy::new

    fn SizeRotationPolicy::new(max_bytes : Int) -> SizeRotationPolicy

    SizeRotationPolicy::record

    fn SizeRotationPolicy::record(self : SizeRotationPolicy, bytes : Int) -> SizeRotationPolicy

    SizeRotationPolicy::reset

    SizeRotationPolicy::should_rotate

    fn SizeRotationPolicy::should_rotate(self : SizeRotationPolicy) -> Bool

    Span

    pub(all) struct Span {
    name : String
    fields : Array[(String, String)]
    start_seq : Int
    }

    Span::enter

    fn Span::enter(logger : Logger, name : String, fields : Array[(String, String)]) -> (Logger, Span)

    Span::exit

    fn Span::exit(self : Span, logger : Logger) -> Logger

    TagSet

    pub(all) struct TagSet {
    tags : Array[String]
    }

    TagSet::add

    fn TagSet::add(self : TagSet, tag : String) -> TagSet

    TagSet::count

    fn TagSet::count(self : TagSet) -> Int

    TagSet::has

    fn TagSet::has(self : TagSet, tag : String) -> Bool

    TagSet::new

    fn TagSet::new() -> TagSet

    TagSet::to_fields

    fn TagSet::to_fields(self : TagSet) -> Array[(String, String)]

    TaggedLogger

    pub(all) struct TaggedLogger {
    logger : Logger
    tags : TagSet
    }

    TaggedLogger::error

    fn TaggedLogger::error(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLogger

    TaggedLogger::get_logger

    fn TaggedLogger::get_logger(self : TaggedLogger) -> Logger

    TaggedLogger::info

    fn TaggedLogger::info(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLogger

    TaggedLogger::new

    fn TaggedLogger::new(logger : Logger) -> TaggedLogger

    TaggedLogger::warn

    fn TaggedLogger::warn(self : TaggedLogger, msg : String, fields : Array[(String, String)]) -> TaggedLogger

    TaggedLogger::with_tag

    fn TaggedLogger::with_tag(self : TaggedLogger, tag : String) -> TaggedLogger

    ThroughputCounter

    pub(all) struct ThroughputCounter {
    name : String
    total : Int
    first_ts : Int
    last_ts : Int
    }

    ThroughputCounter::avg_rate

    fn ThroughputCounter::avg_rate(self : ThroughputCounter) -> Int

    ThroughputCounter::new

    fn ThroughputCounter::new(name : String) -> ThroughputCounter

    ThroughputCounter::record

    fn ThroughputCounter::record(self : ThroughputCounter, ts : Int) -> ThroughputCounter

    ThroughputCounter::total_count

    fn ThroughputCounter::total_count(self : ThroughputCounter) -> Int

    TimeRotationPolicy

    pub(all) struct TimeRotationPolicy {
    max_ticks : Int
    last_rotate_tick : Int
    rotation_count : Int
    }

    TimeRotationPolicy::check

    fn TimeRotationPolicy::check(self : TimeRotationPolicy, current_tick : Int) -> (TimeRotationPolicy, Bool)

    TimeRotationPolicy::count

    fn TimeRotationPolicy::count(self : TimeRotationPolicy) -> Int

    TimeRotationPolicy::new

    fn TimeRotationPolicy::new(max_ticks : Int) -> TimeRotationPolicy

    Timer

    pub(all) struct Timer {
    name : String
    start_seq : Int
    }

    Timer::start

    fn Timer::start(name : String, current_seq : Int) -> Timer

    Timer::stop

    fn Timer::stop(self : Timer, current_seq : Int) -> (String, Int)

    TypedField

    pub(all) struct TypedField {
    key : String
    value : FieldValue
    }

    TypedField::new_bool

    fn TypedField::new_bool(key : String, v : Bool) -> TypedField

    TypedField::new_float

    fn TypedField::new_float(key : String, v : Float) -> TypedField

    TypedField::new_int

    fn TypedField::new_int(key : String, v : Int) -> TypedField

    TypedField::new_str

    fn TypedField::new_str(key : String, v : String) -> TypedField

    TypedField::to_pair

    fn TypedField::to_pair(self : TypedField) -> (String, String)

    assert_log_contains

    fn assert_log_contains(logger : Logger, substring : String) -> Bool

    assert_log_count

    fn assert_log_count(logger : Logger, expected : Int) -> Bool

    assert_log_level_count

    fn assert_log_level_count(logger : Logger, level : Level) -> Int

    create_dev_logger

    fn create_dev_logger() -> Logger

    create_prod_logger

    fn create_prod_logger() -> Logger

    create_test_logger

    fn create_test_logger() -> Logger

    extract_json_like

    fn extract_json_like(message : String) -> Array[(String, String)]

    extract_key_value_pairs

    fn extract_key_value_pairs(message : String) -> Array[(String, String)]

    field_value_to_string

    fn field_value_to_string(v : FieldValue) -> String

    format_color

    fn format_color(record : LogRecord) -> String

    format_compact

    fn format_compact(record : LogRecord) -> String

    format_csv

    fn format_csv(record : LogRecord) -> String

    format_gelf

    fn format_gelf(record : LogRecord, host : String) -> String

    format_json

    fn format_json(record : LogRecord) -> String

    format_logfmt

    fn format_logfmt(record : LogRecord) -> String

    format_ndjson

    fn format_ndjson(record : LogRecord) -> String

    format_pattern

    fn format_pattern(record : LogRecord, pattern : String) -> String

    format_plain

    fn format_plain(record : LogRecord) -> String

    format_syslog

    fn format_syslog(record : LogRecord, app_name : String) -> String

    format_text

    fn format_text(record : LogRecord) -> String

    format_timestamp

    fn format_timestamp(ts : Int) -> String

    format_xml

    fn format_xml(record : LogRecord) -> String

    is_valid_level

    fn is_valid_level(s : String) -> Bool

    level_names

    fn level_names() -> Array[String]

    level_ordinal

    fn level_ordinal(l : Level) -> Int

    level_to_string

    fn level_to_string(l : Level) -> String

    parse_level

    fn parse_level(s : String) -> Level

    should_log

    fn should_log(msg_level : Level, threshold : Level) -> Bool

    summarize

    fn summarize(logger : Logger) -> LogSummary

    typed_fields_to_pairs

    fn typed_fields_to_pairs(fields : Array[TypedField], idx : Int, result : Array[(String, String)]) -> Array[(String, String)]

    with_correlation

    fn with_correlation(fields : Array[(String, String)], corr : CorrelationId, key : String) -> Array[(String, String)]

    word_count

    fn word_count(message : String) -> Int