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)