distribute/log
Types
Log levels from most verbose to least verbose
pub type Level {
Debug
Info
Warn
Error
Off
}
Constructors
-
Debug -
Info -
Warn -
Error -
Off
Structured log entry with metadata
pub type LogEntry {
LogEntry(
Level,
String,
List(#(String, String)),
option.Option(String),
Int,
)
}
Constructors
-
LogEntry( Level, String, List(#(String, String)), option.Option(String), Int, )
Values
pub fn clear_last_log_entry_for_test() -> Nil
Clear the last formatted log entry (test helper)
pub fn debug(
message: String,
metadata: List(#(String, String)),
) -> Nil
Log a debug message
pub fn debug_with_correlation(
message: String,
metadata: List(#(String, String)),
correlation_id: String,
) -> Nil
Log a debug message with correlation ID
pub fn error(
message: String,
metadata: List(#(String, String)),
) -> Nil
Log an error message
pub fn error_with_correlation(
message: String,
metadata: List(#(String, String)),
correlation_id: String,
) -> Nil
Log an error message with correlation ID
pub fn format_log_entry(entry: LogEntry) -> String
Format a log entry as a string
pub fn generate_correlation_id() -> String
Generate a new correlation ID
pub fn info(
message: String,
metadata: List(#(String, String)),
) -> Nil
Log an info message
pub fn info_with_correlation(
message: String,
metadata: List(#(String, String)),
correlation_id: String,
) -> Nil
Log an info message with correlation ID
pub fn last_log_entry_for_test() -> option.Option(String)
Retrieve the last formatted log entry (test helper)
pub fn log(
level: Level,
message: String,
metadata: List(#(String, String)),
correlation_id: option.Option(String),
) -> Nil
Core logging function
pub fn set_backend(backend: String) -> Nil
Set the logging backend implementation used to handle output. Use “console” (default) or “erlang_logger”.
pub fn set_level(level: Level) -> Nil
Set the minimum log level Messages below this level will not be logged
pub fn warn(
message: String,
metadata: List(#(String, String)),
) -> Nil
Log a warning message
pub fn warn_with_correlation(
message: String,
metadata: List(#(String, String)),
correlation_id: String,
) -> Nil
Log a warning message with correlation ID
pub fn with_correlation_id(id: String, f: fn() -> a) -> a
Execute a function with a specific correlation ID