logging
Structured logging for PascalAI applications. Multiple log levels, pluggable sinks (console, file), and formatted log output.
Install
ppm install logging
Usage Example
uses logging;
// Set minimum log level
SetLevel('info');
// Add output sinks
AddSink(ToConsole);
AddSink(ToFile('app.log'));
// Log messages at different levels
Debug('Variable value: {v}', [42]);
Info('Server started on port {port}', [8080]);
Warn('Cache miss rate is high: {rate}%', [85]);
Error('Database connection failed: {msg}', [err]);
// Structured fields
LogWith([
('user', 'alice'),
('action', 'login'),
('ip', '192.168.1.1')
], 'info', 'User logged in');
Features
Five log levels: Debug, Info, Warn, Error, Fatal
SetLevel: filter messages below a minimum level
Multiple sinks: console, file, custom writer
String interpolation in log messages with {key} placeholders
Structured fields for machine-parseable log lines
Automatic timestamps and log level labels