NoctermLogger class

Logger for nocterm_lints plugin.

This logger writes to a file instead of using print() which would break the analysis server plugin. Logging can be configured via environment variables or programmatically.

Environment variables:

  • NOCTERM_LOG_LEVEL: Set minimum log level (debug, info, warning, error)
  • NOCTERM_LOG_DIR: Set custom log directory (defaults to temp directory)
  • NOCTERM_LOG_ENABLED: Set to 'true' to enable logging

Usage:

NoctermLogger.instance.debug('Debug message');
NoctermLogger.instance.info('Info message');
NoctermLogger.instance.warning('Warning message');
NoctermLogger.instance.error('Error message');

Properties

hashCode int
The hash code for this object.
no setterinherited
logFilePath String
Get log file path.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clear log file.
debug(String message, [Object? error, StackTrace? stackTrace]) → void
Log at debug level.
error(String message, [Object? error, StackTrace? stackTrace]) → void
Log at error level.
flush() → void
Flush buffered logs to file.
info(String message, [Object? error, StackTrace? stackTrace]) → void
Log at info level.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setEnabled(bool enabled) → void
Enable or disable logging.
setLogLevel(LogLevel level) → void
Set log level.
toString() String
A string representation of this object.
inherited
warning(String message, [Object? error, StackTrace? stackTrace]) → void
Log at warning level.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

appDir Directory
Get the base directory for app configuration and data
no setter
instance NoctermLogger
Global shared logger instance.
no setter

Static Methods

createForTesting(File logFile) NoctermLogger
Create logger for testing (internal use only).

Constants

appDirName → const String