Reference
DiagnosticLog
Application logs with rotation, repeated-message grouping and error tracking.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/JVM | fr.nimby.sdk | kotlin-client/src/main/kotlin/fr/nimby/sdk/DiagnosticLog.kt |
Public API for SDK 0.9.0-alpha.2. Each entry provides the Kotlin signature and its contract: what the value means, conditions of use and effects to understand. Choose imports from the module shown above.
import fr.nimby.sdk.DiagnosticLogDiagnosticLog
class DiagnosticLog(val component: String, root: Path = defaultRoot(),
maximumBytes: Long = 2 * 1024 * 1024)Application log with rotation and coalescing of identical messages. Component names use 1 to 80 alphanumeric, dot, hyphen or underscore characters, excluding the names “.” and “..”. Do not log every successful read.
DiagnosticLog.component
val component: StringComponent name used in the directory and log entries.
DiagnosticLog.Companion.defaultRoot
fun defaultRoot(): PathUses NRF_LOG_DIR when set; otherwise NimbyRailsFrance/logs under LOCALAPPDATA, or the user directory when that variable is missing.
DiagnosticLog.Companion.forComponent
fun forComponent(name: String): DiagnosticLogReuses the named log in this application so repeated-message coalescing is shared.
DiagnosticLog.directory
val directory: PathComponent directory beneath the log root.
DiagnosticLog.file
val file: PathComponent/application-PID file; does not contain game saves.
DiagnosticLog.write
fun write(message: String, failure: Throwable? = null, level: String = if (failure == null) "INFO" else "ERROR"): UnitWrites an event and optionally an exception; coalesces identical repetitions for 30 seconds. Closes the file after writing; write failure is reported to stderr.
DiagnosticLog.startApplication
fun startApplication(version: String): UnitInstall once at your application entry point. Logs version, uncaught JVM errors and shutdown; preserves the previous handler. Does not intercept every native crash.