Mars XLog logger.
Usage: call open once at startup, log with the level helpers (verbose … fatal), then close before process exit so buffered logs are flushed to disk. Blocking variants (flushSync, decodeSync) run on the calling thread; their non-suffixed counterparts (flush, decode) run on a helper isolate and are safe to await from the UI isolate.
xlog.open(logsDir: dir, cacheDir: dir);
xlog.info('MyTag', 'hello');
xlog.close();
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void - Closes the appender and merges cached logs into the final log files.
-
debug(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at debug level.
-
decode(
Uint8List input, {String? privKey}) → Future< Uint8List> - Decodes a raw xlog log-file image back to plaintext on a helper isolate.
-
decodeSync(
Uint8List input, {String? privKey}) → Uint8List - Decodes a raw xlog log-file image back to plaintext, blocking the calling thread while decoding.
-
error(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at error level.
-
fatal(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at fatal level.
-
flush(
) → Future< void> - Flushes buffered logs to disk, waiting until they are written.
-
flushSync(
) → void - Flushes buffered logs to disk, blocking until they are written.
-
info(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at info level.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
{AppenderMode mode = .async, LogLevel level = .all, required String logsDir, required String cacheDir, int cacheDays = 0, String? namePrefix, CompressMode compressMode = .zlib, CompressLevel compressLevel = .level6, String? pubKey, bool useConsole = false, int maxFileSize = 0, int maxAliveDuration = 10 * 24 * 60 * 60}) → void - Opens the xlog appender and sets the global log level.
-
toString(
) → String -
A string representation of this object.
inherited
-
verbose(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at verbose level.
-
warn(
String tag, String message, [Object? error, StackTrace? stackTrace]) → void - Logs at warn level.
-
write(
LogLevel level, String tag, String message, [Object? error, StackTrace? stackTrace]) → void -
Writes one log entry at
level, tagged withtag.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited