parent
427fc60e9c
commit
ba90b9ca63
@ -0,0 +1,27 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
class Log {
|
||||
static final Log _instance = Log._internal();
|
||||
|
||||
static Logger _logger = Logger();
|
||||
|
||||
factory Log() {
|
||||
_logger = Logger(
|
||||
output: MultiOutput([
|
||||
ConsoleOutput(),
|
||||
FileOutput(file: File("/var/log/proxmox-dash/proxmox-dash.log")),
|
||||
]),
|
||||
level: Level.info,
|
||||
);
|
||||
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();
|
||||
}
|
@ -1,20 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pi_dashboard/logger.dart';
|
||||
|
||||
import 'src/app.dart';
|
||||
import 'src/settings/settings_controller.dart';
|
||||
import 'src/settings/settings_service.dart';
|
||||
|
||||
void main() async {
|
||||
// Set up the SettingsController, which will glue user settings to multiple
|
||||
// Flutter Widgets.
|
||||
final settingsController = SettingsController(SettingsService());
|
||||
|
||||
// Load the user's preferred theme while the splash screen is displayed.
|
||||
// This prevents a sudden theme change when the app is first displayed.
|
||||
await settingsController.loadSettings();
|
||||
|
||||
// Run the app and pass in the SettingsController. The app listens to the
|
||||
// SettingsController for changes, then passes it further down to the
|
||||
// SettingsView.
|
||||
Log().info("Application started");
|
||||
runApp(MyApp(settingsController: settingsController));
|
||||
Log().info("Application stopped");
|
||||
}
|
||||
|
Loading…
Reference in new issue