Examples
- Basic Logging
- Error Handling
- Development Debugging
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
flutter build
, production builds):- Shows only:
info
,warning
,error
,fatal
- Filters out
trace
anddebug
logs for clean user experience
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
The trace message to log.
NeoLogger.debug()
Logs debugging information useful during development and troubleshooting.Parameters
The debug message to log.
NeoLogger.info()
Logs general informational messages about application flow and events.Parameters
The informational message to log.
NeoLogger.warning()
Logs warning messages for potentially problematic situations that don’t prevent execution.Parameters
The warning message to log.
NeoLogger.error()
Logs error messages with exception details and optional stack traces.Required Parameters
The error message describing what went wrong.
The error or exception object that was caught.
Optional Parameters
The stack trace associated with the error for debugging purposes.
NeoLogger.fatal()
Logs critical error messages that typically indicate application-breaking issues.Required Parameters
The fatal error message describing the critical issue.
The error or exception object that caused the fatal condition.
Optional Parameters
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.