You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
proxmox-dashboard/lib/logger.dart

36 lines
699 B

10 months ago
import 'dart:io';
import 'package:logger/logger.dart';
class Log {
static final Log _instance = Log._internal();
static Logger _logger = Logger();
factory Log() {
try {
final logFile = File("/var/log/proxmox-dash/proxmox-dash.log");
if (!logFile.existsSync()) {
logFile.createSync(recursive: true);
}
10 months ago
_logger = Logger(
output: FileOutput(file: logFile),
10 months ago
level: Level.info,
);
} catch (_) {
// No logging available
_logger = Logger();
}
10 months ago
return _instance;
}
void debug(m) => _logger.d(m);
void info(m) => _logger.i(m);
void warn(m) => _logger.w(m);
void error(m) => _logger.e(m);
Log._internal();
}