HemendLogger constructor

HemendLogger({
  1. required Logger logger,
  2. bool enableHierarchicalLogging = false,
  3. List<ILogRecorder> initialListeners = const [],
})

A simple implementation of the ILogManager that provides a logging solution for the application using the Logger form logging package

*logger

Logging node that attached to this ILogManager

if you want to use a node other than Logger.root make sure that you have enabled the enableHierarchicalLogging in the logging package otherwise the initialization of this LogManager will fail

Implementation

HemendLogger({
  required Logger logger,
  bool enableHierarchicalLogging = false,
  List<ILogRecorder> initialListeners = const [],
})  : _logger = logger,
      _listeners = [
        ...initialListeners,
      ] {
  if (logger.parent != null && !hierarchicalLoggingEnabled) {
    if (enableHierarchicalLogging) {
      hierarchicalLoggingEnabled = true;
    } else {
      throw Exception('''
you passed a logger that is not root and your logger is not able to record at hierarchy level
you can enable it by passing [enableHierarchicalLogging]= true or
set `hierarchicalLoggingEnabled = true` before initialization of this manager.
''');
    }
  }
  _init();
}