write method
void
write()
Writes a log message to the logger destination.
correlationId
(optional) transaction id to trace execution through call chain.component
a name of called componentoperation
a name of the executed operation.error
an error object associated with this trace.duration
execution duration in milliseconds.
Implementation
void write(String? correlationId, String? component, String? operation,
Exception? error, int duration) {
var errorDesc =
error != null ? ErrorDescriptionFactory.create(error) : null;
/// Account for cases when component and operation are combined in component.
if (operation == null || operation == '') {
if (component != null && component != '') {
var pos = component.lastIndexOf('.');
if (pos > 0) {
operation = component.substring(pos + 1);
component = component.substring(0, pos);
}
}
}
var trace = OperationTrace(DateTime.now(), _source, component, operation,
correlationId, duration, errorDesc);
_cache.add(trace);
update();
}