Files
easy_dart_module/lib/base/logger/Logger.dart

69 lines
1.2 KiB
Dart

abstract class Logger {
static late Logger _logger;
static Logger getInstance() {
return _logger;
}
static void setInstance(Logger logger) {
_logger = logger;
}
void debug(String msg,
{String? tag,
String? traceId,
String? spanId,
String? parentSpanId,
Map<String, String>? lable});
void info(String msg,
{String? tag,
String? traceId,
String? spanId,
String? parentSpanId,
Map<String, String>? lable});
void warning(String msg,
{String? tag,
String? traceId,
String? spanId,
String? parentSpanId,
Map<String, String>? lable});
void error(String msg,
{String? tag,
String? traceId,
String? spanId,
String? parentSpanId,
Map<String, String>? lable});
}
class LoggerConfig {
LoggerType type;
String host;
String serviceName;
Map<String, String>? lables;
bool print;
LoggerConfig(
{this.host = "",
this.serviceName = "",
this.type = LoggerType.LOKI,
this.print = false,
this.lables});
}
enum LoggerType {
LOKI,
CONSOLSE,
;
}
enum LoggerLevel {
debug(1),
info(2),
warning(3),
error(4),
off(5),
;
final int level;
const LoggerLevel(this.level);
}