StreamLogger class
A logger implementation that contains a stream of LogRecord records.
This is a hierarchical logger:
- loggers are arranged in a tree structure,
- the logger that you pass into the
provideLogger
function is called the root node, - any logger that is contained inside the root node (or any of its children, etc.) is a leaf node,
- each logger has a stream property that contains records logged to it or any of its children.
To access the root logger, pass null
in injectLogger
method.
To access any leaf logger, pass a dot-separated String in injectLogger
method.
Example
var root = StreamLogger.root('myLogger');
provideLogger(root, () {
var child = injectLogger('parent.child');
child.info('My log message');
});
In the example above, the structure of the loggers will resemble this:
- root logger named
myLogger
- logger named
parent
- logger named
child
- logger named
- logger named
Constructors
- StreamLogger.root(String name, {bool recordStackTraces = false, int logLevel = 10000})
- Creates a root logger.
Properties
- fullName → String
-
Returns full name of this logger.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRoot → bool
-
Whether its a root node in the hierarchy.
no setter
- logLevel ↔ int
-
Log level of this logger.
getter/setter pair
- name → String
-
Name of this logger.
final
- recordStackTraces → bool
-
Whether the logger records stack traces.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
LogRecord> -
Broadcast stream of log records.
no setter
Methods
-
dispose(
) → Future< void> -
fatal(
dynamic message) → void -
inherited
-
get(
String? id) → StreamLogger - Creates or retrieves a logger that exists under this node.
-
info(
dynamic message) → void -
inherited
-
log(
int level, dynamic message) → void - Create a new log record in this logger.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
severe(
dynamic message) → void -
inherited
-
shout(
dynamic message) → void -
inherited
-
silly(
dynamic message) → void -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
verbose(
dynamic message) → void -
inherited
-
warning(
dynamic message) → void -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited