Skip to main content

Examples

  • Basic Logging
  • Error Handling
  • Development Debugging
NeoLogger.info("User login successful");

Debug vs Release Mode

NeoLogger automatically adjusts its logging behavior based on whether your app is running in debug or release mode:
Debug Mode (flutter run, development builds):
  • Shows ALL log levels: trace, debug, info, warning, error, fatal
  • Perfect for development and debugging
Release Mode (flutter build, production builds):
  • Shows only: info, warning, error, fatal
  • Filters out trace and debug logs for clean user experience
This means you can safely leave trace and debug calls throughout your codebase during development - they won’t clutter the user experience in production builds.

Methods

NeoLogger.trace()

Logs detailed execution flow information, typically used for fine-grained debugging. Great for tracing your code.

Parameters

message
String
required
The trace message to log.

NeoLogger.debug()

Logs debugging information useful during development and troubleshooting.

Parameters

message
String
required
The debug message to log.

NeoLogger.info()

Logs general informational messages about application flow and events.

Parameters

message
String
required
The informational message to log.

NeoLogger.warning()

Logs warning messages for potentially problematic situations that don’t prevent execution.

Parameters

message
String
required
The warning message to log.

NeoLogger.error()

Logs error messages with exception details and optional stack traces.

Required Parameters

message
String
required
The error message describing what went wrong.
error
dynamic
required
The error or exception object that was caught.

Optional Parameters

stackTrace
StackTrace
The stack trace associated with the error for debugging purposes.

NeoLogger.fatal()

Logs critical error messages that typically indicate application-breaking issues.

Required Parameters

message
String
required
The fatal error message describing the critical issue.
error
dynamic
required
The error or exception object that caused the fatal condition.

Optional Parameters

stackTrace
StackTrace
The stack trace associated with the fatal error.

Best Practices

  • Use appropriate log levels: Choose the correct severity level for each message to enable proper filtering in production.
  • Avoid logging sensitive data: Never log passwords, tokens, or other sensitive user information in production apps.
  • Use trace() and debug() freely: These logs are automatically filtered out in release builds, so you can safely leave them in your code for development debugging.
  • Reserve info() for user-relevant events: Since info logs appear in production, use them for events that might be relevant for support or monitoring.

Integration Notes

  • Thread Safety: All logging methods are thread-safe and can be called from any isolate.
I