RemoteLogger class
A logger that sends log messages to a remote server.
- Inheritance
-
- Object
- BaseLogger
- RemoteLogger
Constructors
-
RemoteLogger({required String serverUrl, Map<
String, String> ? headers, int batchSize = 10, Duration flushInterval = const Duration(seconds: 5), RemoteRequestBodyBuilder? requestBodyBuilder, LoggerFormatter? formatter, LoggerDateFormatter? dateFormatter})
Properties
- batchSize → int
-
The number of logs to buffer before sending.
final
- dateFormatter ↔ LoggerDateFormatter?
-
The date formatter for log messages.
getter/setter pairinherited
- flushInterval → Duration
-
The interval at which to flush logs if the batch size hasn't been reached.
final
- formatter ↔ LoggerFormatter
-
The formatter for log messages.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
Custom headers to include in the request.
final
- id → String
-
Unique identifier for the logger.
finalinherited
- requestBodyBuilder → RemoteRequestBodyBuilder?
-
Custom builder for the request body.
Must be a static or top-level function.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverUrl → String
-
The server URL to send log messages to.
final
Methods
-
dispose(
) → void -
Disposes the logger and releases any resources.
inherited
-
info(
String message, String scope) → void -
Logs an informational message.
messageis the log message.scopeis the scope or context of the log.inherited -
log(
Level level, String message, String scope, dynamic exception, StackTrace? stackTrace, LoggerFormatter formatter) → void -
Writes a log entry.
levelis the severity level of the log.messageis the log message.scopeis the scope or context of the log.throwableis an optional error or exception associated with the log.stackTraceis an optional stack trace associated with the log.formatteris a function to format the log message.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
severe(
String message, String scope, Exception? exception, StackTrace? stackTrace) → void -
Logs a severe error message.
messageis the log message.scopeis the scope or context of the log.exceptionis the associated exception.stackTraceis the associated stack trace.inherited -
shout(
String message, String scope, Error? error, StackTrace? stackTrace) → void -
Logs a shout message.
messageis the log message.scopeis the scope or context of the log.erroris the associated error.stackTraceis the associated stack trace.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
warning(
String message, String scope) → void -
Logs a warning message.
messageis the log message.scopeis the scope or context of the log.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited