0 purchases
strategic logger
Strategic Logger - One Call Logs All! #
Easy to use and extensible logger designed to support multiple logging strategies, like Firebase Crashlytics, Sentry, Firebase Analytics, and other that you want.
Show some ❤️ and star the repo to support the project
Features #
Multiple & Built-in Log Strategies: Firebase Crashlytics, Sentry, Firebase Analytics, ConsoleLog already implemented. (See examples tab)
Customizable: Extendable to include custom logging strategies depending on your application needs.
Easy to Use: Simple API for logging messages, errors, and fatal incidents across all integrated services.
Robust Error Handling: Includes predefined error types for handling common logging errors effectively.
Getting Started #
To get started with Strategic Logger, add it to your project as a dependency:
dependencies:strategic_logger: ^0.1.10
Initialization #
Initialize the logger once during the startup of your application:
import 'package:strategic\_logger/strategic\_logger.dart';
void main() {
logger.initialize(
level: LogLevel.info,
strategies: [
ConsoleLogStrategy(),
FirebaseAnalyticsLogStrategy(),
FirebaseCrashlyticsLogStrategy(),
],
);
}
copied to clipboard
Usage #
Logging messages is straightforward: (Easy and clean-code)
logger.log('This is an info log');
logger.error('This is an error message');
logger.fatal('This is a fatal error');
copied to clipboard
You can also log detailed events:
logger.log('User logged in', event: LogEvent(eventName: 'user\_login'));
copied to clipboard
Documentation #
For full documentation, including all configuration options and advanced usage examples, see examples tab.
Extending the Logger (Your Custom Strategy) #
To add a custom log strategy, extend the LogStrategy class:
class MyCustomLogStrategy extends LogStrategy {
@override
Future log({dynamic message, LogEvent? event}) async {
// Implement custom logging logic here
}
}
copied to clipboard
Register your custom strategy during logger initialization.
Contributing #
Contributions are welcome! Please read the contributing guide on our GitHub repository to get started.
License #
Strategic Logger is released under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.