Class GridJsLogger

GridJsLogger class

Provides a lightweight logging system for GridJs server. Supports console and file output with configurable log levels. Default level is None. In DEBUG build, the default level is Debug (outputs all messages). Supports log file rolling by day/week/month.

public static class GridJsLogger

Properties

NameDescription
static EnableConsoleOutput { get; set; }Gets or sets whether to output log messages to the console. Default is false.
static EnableFileOutput { get; set; }Gets or sets whether to output log messages to a file. Default is false. Must call SetLogFile or SetLogDirectory before enabling.
static Level { get; set; }Gets or sets the minimum log level. Messages below this level will be ignored. Default is None.
static LogFilePath { get; }Gets the current log file path, or null if not set.
static MaxFileSize { get; set; }Gets or sets the maximum size (in bytes) for a single log file before rolling. Only effective when rolling is enabled. 0 means no size limit. Default is 0.

Methods

NameDescription
static CloseLogFile()Closes the log file writer and disables file output.
static Debug(string)Logs a debug level message.
static Error(string)Logs an error level message.
static Info(string)Logs an info level message.
static Log(GridJsLogLevel, string)Logs a message at the specified level.
static SetLogDirectory(string)Sets the log directory with daily rolling file strategy and enables file output. Log files will be named as: gridjs_{period}.log
static SetLogDirectory(string, GridJsLogRolling)Sets the log directory with rolling file strategy and enables file output. Log files will be named as: gridjs_{period}.log
static SetLogDirectory(string, GridJsLogRolling, string)Sets the log directory with rolling file strategy and enables file output. Log files will be named as: {prefix}_{period}.log Examples: gridjs_2026-07-27.log (Daily), gridjs_2026-W30.log (Weekly), gridjs_2026-07.log (Monthly)
static SetLogFile(string)Sets the log file path and enables file output (single file mode, no rolling). Appends to existing file.
static SetLogFile(string, bool)Sets the log file path and enables file output (single file mode, no rolling).
static Warn(string)Logs a warning level message.

See Also