NRF SDK 0.9

Reference

DiagnosticLog

Application logs with rotation, repeated-message grouping and error tracking.

Usage context

ModulePackageSDK source
Kotlin/JVMfr.nimby.sdkkotlin-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.

Imports on this page
import fr.nimby.sdk.DiagnosticLog

DiagnosticLog

fr.nimby.sdk · class
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

fr.nimby.sdk · val
val component: String

Component name used in the directory and log entries.

DiagnosticLog.Companion.defaultRoot

fr.nimby.sdk · fun
fun defaultRoot(): Path

Uses NRF_LOG_DIR when set; otherwise NimbyRailsFrance/logs under LOCALAPPDATA, or the user directory when that variable is missing.

DiagnosticLog.Companion.forComponent

fr.nimby.sdk · fun
fun forComponent(name: String): DiagnosticLog

Reuses the named log in this application so repeated-message coalescing is shared.

DiagnosticLog.directory

fr.nimby.sdk · val
val directory: Path

Component directory beneath the log root.

DiagnosticLog.file

fr.nimby.sdk · val
val file: Path

Component/application-PID file; does not contain game saves.

DiagnosticLog.write

fr.nimby.sdk · fun
fun write(message: String, failure: Throwable? = null, level: String = if (failure == null) "INFO" else "ERROR"): Unit

Writes 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

fr.nimby.sdk · fun
fun startApplication(version: String): Unit

Install once at your application entry point. Logs version, uncaught JVM errors and shutdown; preserves the previous handler. Does not intercept every native crash.