log method
- Parameters:
- logLevel: The level of the log message (e.g., verbose, debug, info, warning, error).
- tag: A tag used to identify the source of the log message (e.g., the class or method name).
- message: The log message to be recorded.
- error: An optional error object to include additional error details in the log.
Implementation
void log(LogLevel logLevel, String? tag, String message, [Throwable? t]) {
if (BuildConfig.remoteLogsEnabled) {
final now = DateTime.now();
final remoteLog = RemoteLog(
logLevel: _logLevelToString(logLevel),
tag: tag,
message: message,
throwable: t?.toString(),
time: timeFormat.format(now),
);
final updates = {
'-DeviceDetails': deviceInfo.toJson(),
_getLogEmoji(logLevel) + now.millisecondsSinceEpoch.toString():
remoteLog.toJson()
};
logRef.update(updates);
}
_consoleLogcat(logLevel, message, t);
}