Expand description
The logger of the desktop release runners (nsh-macos-app,
nsh-windows-app, nsh-linux-app): one filter, one rolling file in the
app’s data directory, and the platform’s own place for each line.
- What is logged:
RUST_LOGwhen it is set, inenv_logger‘s syntax (info,my_app=debug,js=info,warn,nsh_engine::updates=info); else the runners’ rule, warnings, errors and the app’sjslines (console.*), and every line from info up when run bynsh run. - Where: a rolling file,
app.login the directorynsh.json"logDir"names, elselogsin the app’s data directory (log_directory,log_dir), whose path apps read (nsh_core::element::log_file, TSprocess.logFile), and the platform’s output the runner handsLogOptions::output(the unified log, the debugger’s output, stderr). - The file: one line per record,
<UTC time> <LEVEL> <target>: <message>. PastMAX_FILE_BYTESit becomesapp.1.log(the one before thatapp.2.log, …) and a newapp.logstarts;KEPT_FILESolder files are kept. A file that cannot be made or written is left alone, tried again afterRETRY_AFTER: the app and the platform’s output carry on without it. - Panics: written to the file whatever the filter, as
ERROR panic:lines in the words Rust prints them in (with a backtrace whenRUST_BACKTRACEasks for one), and then handed to the hook the process had, which prints them to stderr as before. A packaged app’s stderr is often nowhere (a Windows GUI program, a Mac app opened from Finder), so the file is where a crash can be read.
Structs§
- LogOptions
- What
installsets up.
Constants§
- KEPT_
FILES - How many rolled-over files are kept beside
app.log(app.1.logup toapp.<KEPT_FILES>.log). - MAX_
FILE_ BYTES - The size past which the log file rolls over to
app.1.log. - RETRY_
AFTER - How long the logger waits before it tries again to open a log file it could not open or write.
Functions§
- install
- Makes the runners’ logger the process’s logger, filtered by
RUST_LOGwhen it is set, and records its file fornsh_core::element::log_file. Returns whether it did:falsewhen the process has a logger already. - log_dir
- The directory of the log files of app
app_idwhen it names no data directory of its own:logsin the one under the system’s directory for apps’ data (<support dir>/<app id>/logs).Nonewhere the system has none. - log_
directory - The directory the desktop runners write the log files of app
app_idin:log_dir(nsh.json"logDir", already resolved) when the app names one, elselogsindata_dir("dataDir"), elselog_dir’s default.
Type Aliases§
- LogOutput
- The platform’s own place for each line the filter lets through.