Skip to main content

alien_core/
application_logs.rs

1/// A recognized application-provided log level.
2pub use lognorm::Severity as ApplicationLogLevel;
3
4/// Reads an unambiguous severity using the shared normalization library.
5pub fn parse_application_log_level(body: &str) -> Option<ApplicationLogLevel> {
6    lognorm::parse(body).severity()
7}
8
9/// Projects a readable structured message while callers retain the original.
10pub fn parse_application_log_message(body: &str) -> Option<String> {
11    let log = lognorm::parse(body);
12    (log.outcome() == lognorm::ParseOutcome::Structured && log.message() != body)
13        .then(|| log.message().to_owned())
14}