LogService class
DataHubs logging solution.
This service is automatically added to any ServiceHost to provide logging functionality to other modules of the DataHub framework.
The configuration value datahub.log
defines the initial log level.
See enum values in LogLevel.
Messages can be logged by resolving the LogService and calling its logging methods.
final log = resolve<LogService>();
log.w('This is a warning!');
The default LogService uses a ConsoleLogBackend to write messages to stdout. If a different LogBackend implementation is required, simply pass it into ServiceHost constructor.
final host = ServiceHost([
...
], logBackend: CustomLogBackendImpl());
- Inheritance
-
- Object
- BaseService
- LogService
Constructors
- LogService(LogBackend _backend)
Properties
- configPath → ConfigPath?
-
finalinherited
- environment → Environment
-
Fetch the environment configuration from ConfigService.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
c(
String message, {String? sender, dynamic error, StackTrace? trace}) → void -
config<
T> (String path) → T -
Fetches a configuration value from ConfigService.
inherited
-
configObject<
T extends TransferObjectBase> (String path, TransferBean< T> bean) → T -
Fetches a configuration value from ConfigService and parse it into the
TransferObject.
inherited
-
critical(
String message, {String? sender, dynamic error, StackTrace? trace}) → void -
d(
String message, {String? sender}) → void -
debug(
String message, {String? sender}) → void -
e(
String message, {String? sender, dynamic error, StackTrace? trace}) → void -
error(
String message, {String? sender, dynamic error, StackTrace? trace}) → void -
i(
String message, {String? sender}) → void -
info(
String message, {String? sender}) → void -
initialize(
) → Future< void> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setLogLevel(
LogLevel level) → void -
shutdown(
) → Future< void> -
override
-
toString(
) → String -
A string representation of this object.
inherited
-
v(
String message, {String? sender}) → void -
verbose(
String message, {String? sender}) → void -
w(
String message, {String? sender, dynamic error, StackTrace? trace}) → void -
warn(
String message, {String? sender, dynamic error, StackTrace? trace}) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited