Log class final
A convenient logging utility built on top of LogFactory.
The Log
class provides a simplified and readable interface for
logging messages at various log levels such as info, warning, error,
debug, fatal, and trace. It is typically used throughout the JetLeaf
framework to emit consistent and structured log output.
Example:
final log = Log('MyComponent');
log.info('Application started.');
log.error('Something went wrong.', error: exception, stacktrace: stack);
log.debug('Debugging some internal state...');
The tag
passed to the constructor is used to identify the origin
of log messages, such as a class or module name.
This class is final
, so it cannot be extended.
- Inheritance
-
- Object
- LogFactory
- Log
Constructors
- Log(String tag, {bool canPublish = true})
- A convenient logging utility built on top of LogFactory.
Properties
- canPublish → bool
-
Whether the logger can publish logs to the console.
finalinherited
- entry → _LogFactoryEntry
-
Returns the log entry for the current logger.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- logListener ↔ LoggingListener?
-
The
LogListener
to use for this factory.getter/setter pairinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tag → String
-
A custom label or category used to identify the logger instance.
finalinherited
Methods
-
add(
LogLevel level, String message, {Object? error, StackTrace? stacktrace}) → void -
Adds a
message
to the log buffer under the specifiedlevel
.inherited -
addAll(
_LogFactoryEntry entry) → void -
Adds all logs from the given
entry
to the internal super entry buffer.inherited -
clear(
) → void -
Clears all logs from every LogLevel.
inherited
-
debug(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
DEBUG
level. -
error(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
ERROR
level. -
fatal(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
FATAL
level. -
getError(
_LogFactoryContent content) → Object? -
Returns the error from the given
content
.inherited -
getIsDebugEnabled(
) → bool -
Returns whether
DEBUG
-level logging is currently enabled.inherited -
getIsErrorEnabled(
) → bool -
Returns whether
ERROR
-level logging is currently enabled.inherited -
getIsFatalEnabled(
) → bool -
Returns whether
FATAL
-level logging is currently enabled.inherited -
getIsInfoEnabled(
) → bool -
Returns whether
INFO
-level logging is currently enabled.inherited -
getIsTraceEnabled(
) → bool -
Returns whether
TRACE
-level logging is currently enabled.inherited -
getIsWarnEnabled(
) → bool -
Returns whether
WARN
-level logging is currently enabled.inherited -
getMessage(
_LogFactoryContent content) → String -
Returns the message from the given
content
.inherited -
getProperty(
String key) → String? -
Retrieves the property value associated with
key
.inherited -
getStackTrace(
_LogFactoryContent content) → StackTrace? -
Returns the stack trace from the given
content
.inherited -
info(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
INFO
level. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
publish(
) → void -
Publishes all logs to the console.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
trace(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
TRACE
level. -
warn(
String message, {Object? error, StackTrace? stacktrace}) → void -
Logs a message at the
WARN
level.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited