log method
Logs a message with the specified type and additional tags.
This is the primary logging method that merges the class's loggerTags
with any additional tags provided in the call.
Example:
await log(
'Processing payment for order ${orderId}',
type: LogType.info,
tags: ['processing', 'order_$orderId'],
);
Parameters:
message
- The message to logtype
- The type/severity of the message (default: info)tags
- Additional tags to merge withloggerTags
Tag Merging: The final tag list will be [...loggerTags, ...tags]
,
so class tags appear first, followed by method-specific tags.
Throws:
LoggerException
if the global logger has been disposed
Implementation
Future<void> log(
String message, {
LogType type = LogType.info,
List<String> tags = const [],
}) async {
await logger.log(message, type: type, tags: [...loggerTags, ...tags]);
}