CachedLogger class abstract
Abstract logger that caches captured log messages in memory and periodically dumps them. Child classes implement saving cached messages to their specified destinations.
Configuration parameters
level
: maximum log level to capture- source: source (context) name
options
:- interval: interval in milliseconds to save log messages (default: 10 seconds)
max_cache_size
: maximum number of messages stored in this cache (default: 100)
References
- *:context-info:*:*:1.0 (optional) ContextInfo to detect the context id and specify counters source
See ILogger See Logger See LogMessage
Constructors
- CachedLogger()
- Creates a new instance of the logger.
Properties
-
cache
↔ List<
LogMessage> -
read / write
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- interval ↔ int
-
read / write
- lastDumpTime ↔ int
-
read / write
- maxCacheSize ↔ int
-
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- source ↔ String?
-
read / writeinherited
- updated ↔ bool
-
read / write
Methods
-
clear(
) → void - Clears (removes) all cached log messages.
-
composeError(
Exception error) → String -
Composes an human-readable error description
inherited
-
configure(
ConfigParams config) → void -
Configures component by passing configuration parameters.
override
-
debug(
String? correlationId, String message, [List? args]) → void -
Logs a high-level debug information for troubleshooting.
inherited
-
dump(
) → void - Dumps (writes) the currently cached log messages.
-
error(
String? correlationId, Exception? error, String message, [List? args]) → void -
Logs recoverable application error.
inherited
-
fatal(
String? correlationId, Exception? error, String message, [List? args]) → void -
Logs fatal (unrecoverable) message that caused the process to crash.
inherited
-
getLevel(
) → LogLevel -
Gets the maximum log level.
Messages with higher log level are filtered out.
inherited
-
getSource(
) → String? -
Gets the source (context) name.
inherited
-
info(
String? correlationId, String message, [List? args]) → void -
Logs an important information message
inherited
-
log(
LogLevel level, String? correlationId, Exception? error, String message, [List? args]) → void -
Logs a message at specified log level.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
save(
List< LogMessage> messages) → Future - Saves log messages from the cache.
-
setLevel(
LogLevel value) → void -
Set the maximum log level.
inherited
-
setReferences(
IReferences references) → void -
Sets references to dependent components.
inherited
-
setSource(
String value) → void -
Sets the source (context) name.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
trace(
String? correlationId, String message, [List? args]) → void -
Logs a low-level debug information for troubleshooting.
inherited
-
update(
) → void - Makes message cache as updated and dumps it when timeout expires.
-
warn(
String? correlationId, String message, [List? args]) → void -
Logs a warning that may or may not have a negative impact.
inherited
-
write(
LogLevel level, String? correlationId, Exception? error, String message) → void -
Writes a log message to the logger destination.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited