mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
NEW - [Networking] Strict TLS/SSL validation is now disabled globally - [Routing] Hold the AppBar back button to pop back to the home page of the module - [Settings/Sonarr] Toggle to enable Sonarr v3 features - [Sonarr] Complete rewrite of Sonarr - [Sonarr] State is now held across module switches - [Sonarr/Overview] View tags applied to series - [Sonarr/Catalogue] (v3 only) Ability to set and update language profile - [Sonarr/Catalogue] Ability to view all, only monitored, or only unmonitored series - [Sonarr/Releases] (v3 only) Ability to interactively search for season packs - [Sonarr/Releases] Ability to view all, only approved, or only rejected releases TWEAKS - [Settings] Removed all toggles for strict TLS - [Sonarr] Many tweaks to Sonarr's design - [Sonarr/Add] (v3 only) Tapping an already-added series will take you to the series page - [Sonarr/Add] Automatically navigate to newly added series - [Sonarr/Series] Toggling monitored state of series has now been moved to the edit prompt FIXES - [Images] Images will now load for invalid/self-signed certificates - [Tautulli/Activity] Fix grey screen for music activity - [TextField] Fix TextField actions (cut, copy, paste, etc.) not showing - [Timestamps] Fix 12:xx AM being shown as 00:xx AM - Additional small bug fixes
92 lines
3.1 KiB
Dart
92 lines
3.1 KiB
Dart
import 'dart:async';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core/constants.dart';
|
|
import 'package:lunasea/core/database.dart';
|
|
import 'package:sentry/sentry.dart';
|
|
import 'package:stack_trace/stack_trace.dart';
|
|
import 'package:f_logs/f_logs.dart' show FLog, DataLogType, FormatType, LogsConfig;
|
|
export 'package:dio/dio.dart' show DioError;
|
|
|
|
class LunaLogger {
|
|
LunaLogger._();
|
|
static final SentryClient _sentry = SentryClient(dsn: Constants.SENTRY_DSN);
|
|
|
|
static void initialize() {
|
|
LogsConfig config = FLog.getDefaultConfigurations()
|
|
..formatType = FormatType.FORMAT_SQUARE
|
|
..timestampFormat = 'MMMM dd, y - hh:mm:ss a';
|
|
FLog.applyConfigurations(config);
|
|
FlutterError.onError = (FlutterErrorDetails details, { bool forceReport = false }) async {
|
|
bool inDebugMode = false;
|
|
assert(inDebugMode = true);
|
|
if (inDebugMode) {
|
|
FlutterError.dumpErrorToConsole(details, forceReport: forceReport);
|
|
}
|
|
Zone.current.handleUncaughtError(details.exception, details.stack);
|
|
};
|
|
}
|
|
|
|
static void debug(String className, String methodName, String text, {DataLogType type = DataLogType.DEFAULT}) {
|
|
FLog.debug(
|
|
className: className,
|
|
methodName: methodName,
|
|
text: text,
|
|
dataLogType: type.toString(),
|
|
);
|
|
}
|
|
|
|
static void warning(String className, String methodName, String text, {DataLogType type = DataLogType.DEFAULT}) {
|
|
FLog.warning(
|
|
className: className,
|
|
methodName: methodName,
|
|
text: text,
|
|
dataLogType: type.toString(),
|
|
);
|
|
}
|
|
|
|
static void error(String className, String methodName, String text, dynamic error, StackTrace trace, {
|
|
DataLogType type = DataLogType.DEFAULT,
|
|
bool uploadToSentry = true,
|
|
}) {
|
|
FLog.error(
|
|
className: className,
|
|
methodName: methodName,
|
|
text: text,
|
|
exception: error,
|
|
stacktrace: trace,
|
|
dataLogType: type.toString(),
|
|
);
|
|
if(uploadToSentry && LunaSeaDatabaseValue.ENABLED_SENTRY.data) _sentry.captureException(
|
|
exception: error,
|
|
stackTrace: trace,
|
|
);
|
|
}
|
|
|
|
static void fatal(dynamic error, StackTrace trace, {
|
|
DataLogType type = DataLogType.DEFAULT,
|
|
bool uploadToSentry = true,
|
|
}) {
|
|
Trace _trace = Trace.from(trace);
|
|
FLog.fatal(
|
|
className: _trace.frames.length >= 1 ? _trace.frames[1].uri.toString() ?? 'Unknown' : 'Unknown',
|
|
methodName: _trace.frames.length >= 1 ? _trace.frames[1].member.toString() ?? 'Unknown' : 'Unknown',
|
|
text: error.toString(),
|
|
exception: error,
|
|
stacktrace: trace,
|
|
dataLogType: type.toString(),
|
|
);
|
|
if(LunaSeaDatabaseValue.ENABLED_SENTRY.data) _sentry.captureException(
|
|
exception: error,
|
|
stackTrace: trace,
|
|
);
|
|
}
|
|
|
|
static void exportLogs() {
|
|
FLog.exportLogs();
|
|
}
|
|
|
|
static void clearLogs() {
|
|
FLog.clearLogs();
|
|
}
|
|
}
|