Log class

πŸ“ Log - Advanced Logging for Dart & Flutter πŸ“’

This class provides an easy-to-use API for structured logging with emoji-enhanced messages 🏷️.

🎯 Understanding the fileName Parameter

  • This parameter is mandatory and should represent the file where the log is triggered for better debugging.
  • Best Practices for fileName:
    • πŸ“Œ fileName: "home_page.dart" β†’ Logs from the main UI
    • πŸ”‘ fileName: "auth_service.dart" β†’ Authentication logs
    • 🌐 fileName: "network_service.dart" β†’ Network-related logs

Constructors

Log({LogRepository? logger})
πŸ”§ Creates an instance of Log

Properties

hashCode β†’ int
The hash code for this object.
no setterinherited
runtimeType β†’ Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) β†’ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() β†’ String
A string representation of this object.
inherited

Operators

operator ==(Object other) β†’ bool
The equality operator.
inherited

Static Methods

data(dynamic data, {required String fileName}) β†’ void
βœ… Logs a DATA-level message (Logs structured data)
debug(String message, {required String fileName}) β†’ void
🍺 Logs a DEBUG-level message (Used for debugging)
error(String message, {required String fileName}) β†’ void
πŸ”₯ Logs an ERROR-level message (Something went wrong)
fatal(String message, {required String fileName}) β†’ void
πŸ’€ Logs a FATAL-level message (Critical system failure)
info(String message, {required String fileName}) β†’ void
πŸ”΅ Logs an INFO-level message (General application events)
json(dynamic jsonData, {required String fileName}) β†’ void
πŸ“œ Logs a JSON-level message (Logs structured JSON data)
log(String message, {required String fileName, LogLevel level = LogLevel.info}) β†’ void
πŸ” Internal Log Handler
special(String message, {required String fileName}) β†’ void
πŸ’œ Logs a SPECIAL-level message (For custom logs)
warning(String message, {required String fileName}) β†’ void
🚨 Logs a WARNING-level message (Potential problems)