scoop:scoop.log:0.1.0
src/record.scoop
Selected production source · src/record.scoop
1
package scoop.log3
/** Log severity, ordered from Trace through Error. */4
public enum LogLevel : ToString {5
/** Detailed execution tracing. */6
Trace,7
/** Diagnostic information normally disabled in production. */8
Debug,9
/** Normal application events. */10
Info,11
/** A condition requiring attention. */12
Warn,13
/** An operation failed. */14
Error16
/** Returns the stable uppercase label used in text logs. */17
public override fun toString(): String = when (this) {18
case Trace -> "TRACE"19
case Debug -> "DEBUG"20
case Info -> "INFO"21
case Warn -> "WARN"22
case Error -> "ERROR"23
}24
}26
/**27
* An evaluated log event. Exception fields retain their original objects; they are not deep28
* snapshots of mutable exception state.29
*/30
public struct LogRecord(31
/** The requested event severity, including when message evaluation fails. */32
val level: LogLevel,33
/** The caller-selected category. */34
val target: String,35
/** The evaluated message or a message-evaluation failure description. */36
val message: String,37
/** The original logging call's source location. */38
val location: SourceLocation,39
/** An optional application exception supplied by the caller. */40
val cause: Throwable? = None,41
/** The original exception thrown by the message function, if any. */42
val messageFailure: Throwable? = None43
)