Logger¶
Logging utilities for WaspLib scripts.
ELogLevel¶
ELogLevel = enum(SUCCESS, WARN, ERROR);
Enum representing log message severity levels.
TLogger¶
Record for managing script logging to files and console output.
Logger.Init¶
procedure TLogger.Init();
Initializes the logger, creating the log directory and file. Called automatically at script start.
Logger.Setup¶
procedure TLogger.Setup(name: String = '');
Configures the logger with a script name. Creates a dedicated log directory.
Example:
Logger.Setup('MyScript');
Logger variable¶
Global TLogger variable.
GetDebugLn¶
function GetDebugLn(text: String; log: Boolean = True): String;
function GetDebugLn(name, text: String; log: Boolean = True): String; overload;
function GetDebugLn(text: String; level: ELogLevel; log: Boolean = True): String; overload;
function GetDebugLn(name, text: String; level: ELogLevel; log: Boolean = True): String; overload;
Returns a formatted debug string with timestamp.
Optionally logs to file and applies color formatting based on level.
Logger.Info¶
procedure TLogger.Info(text: String; vars: TVariantArray = []);
Logs an info message. Duplicate consecutive messages are suppressed unless
Logger.RepeatedMessages is True.
Logger.Success¶
procedure TLogger.Success(text: String; vars: TVariantArray = []);
Logs a success message (green colored output).
Logger.Warn¶
procedure TLogger.Warn(text: String; vars: TVariantArray = []);
Logs a warning message (yellow colored output).
Logger.Error¶
procedure TLogger.Error(text: String; vars: TVariantArray = []);
Logs an error message (red colored output).
Logger.Exception¶
procedure TLogger.Exception(text: String; vars: TVariantArray = []);
Logs an error message and raises an exception to halt script execution.