mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 10:29:06 +02:00
85 lines
3.0 KiB
Dart
85 lines
3.0 KiB
Dart
import "package:arcane_framework/arcane_framework.dart";
|
|
|
|
/// A singleton class that acts as the central hub for various services in the
|
|
/// Arcane framework.
|
|
///
|
|
/// `Arcane` provides access to important services like logging, feature flags,
|
|
/// authentication, theming, secure storage, and ID management. It also offers a
|
|
/// convenient method for logging messages using the integrated logger.
|
|
abstract class Arcane {
|
|
/// Provides access to the singleton instance of the logger service.
|
|
///
|
|
/// The `ArcaneLogger` is used for logging messages throughout the app.
|
|
static ArcaneLogger get logger => ArcaneLogger.I;
|
|
|
|
/// Provides access to the singleton instance of the feature flags service.
|
|
///
|
|
/// `ArcaneFeatureFlags` manages feature toggles, allowing you to enable or
|
|
/// disable features dynamically.
|
|
static ArcaneFeatureFlags get features => ArcaneFeatureFlags.I;
|
|
|
|
/// Provides access to the singleton instance of the authentication service.
|
|
///
|
|
/// `ArcaneAuthenticationService` manages user authentication, login, and
|
|
/// signup processes.
|
|
static ArcaneAuthenticationService get auth => ArcaneAuthenticationService.I;
|
|
|
|
/// Provides access to the singleton instance of the theme management service.
|
|
///
|
|
/// `ArcaneTheme` allows switching between light and dark themes and
|
|
/// customizing them.
|
|
static ArcaneTheme get theme => ArcaneTheme.I;
|
|
|
|
/// Returns a list of all services available in the Arcane framework.
|
|
///
|
|
/// This list includes the feature flags, authentication, theme, and ID services.
|
|
static List<ArcaneService> get services => [
|
|
features,
|
|
auth,
|
|
theme,
|
|
];
|
|
|
|
/// Logs a message using the integrated logger.
|
|
///
|
|
/// This method is a convenient way to log messages with optional module,
|
|
/// method, log level, stack trace, and additional metadata. The default log
|
|
/// level is `Level.debug`.
|
|
///
|
|
/// Example:
|
|
/// ```dart
|
|
/// Arcane.log("This is a log message", module: "MyModule", method: "MyMethod");
|
|
/// ```
|
|
///
|
|
/// - [message]: The message to log.
|
|
/// - [module]: Optional name of the module from which the log originated.
|
|
/// - [method]: Optional name of the method from which the log originated.
|
|
/// - [level]: The log level (e.g., `Level.debug`, `Level.error`), defaults to
|
|
/// `Level.debug`.
|
|
/// - [stackTrace]: Optional stack trace information.
|
|
/// - [metadata]: Optional additional metadata in key-value pairs.
|
|
/// - [extra]: Optional data passed to the logger.
|
|
/// - [skipAutodetection]: Bypass automatically determining the module, method,
|
|
/// and file/line number of log messages.
|
|
static void log(
|
|
String message, {
|
|
String? module,
|
|
String? method,
|
|
Level level = Level.debug,
|
|
StackTrace? stackTrace,
|
|
Map<String, String>? metadata,
|
|
Object? extra,
|
|
bool skipAutodetection = false,
|
|
}) {
|
|
ArcaneLogger.I.log(
|
|
message,
|
|
module: module,
|
|
method: method,
|
|
level: level,
|
|
stackTrace: stackTrace,
|
|
metadata: metadata,
|
|
extra: extra,
|
|
skipAutodetection: skipAutodetection,
|
|
);
|
|
}
|
|
}
|