flutter_devlog 0.2.0
flutter_devlog: ^0.2.0 copied to clipboard
A lightweight, extensible colored console logger for Flutter with structured log records, source location, JSON, levels, tags and scopes.
0.2.0 #
New features:
-
Release builds are now always silent: even
DevLog.enabled = truehas no effect in release mode. The check is a compile-time constant (kReleaseMode), so logging code is tree-shaken out of release builds.enablednow only controls debug and profile builds. -
Structured log sink:
DevLog.onLognow receives aLogRecordwith the level, raw message (no ANSI codes), channel name, tag, error, stack trace, timestamp, and source location. Userecord.formattedfor the colored console string. -
DevLog.configure(...)to set several options in one call andDevLog.reset()to restore all defaults (handy in testtearDown). -
Tag filtering:
DevLog.allowedTags(allowlist) andDevLog.blockedTags(denylist). -
Timestamps: set
DevLog.showTimestamps = truefor anHH:mm:ss.SSSprefix. -
ScopedLoggerparity:lazy(),child()for nested scopes (Auth/Login), alabelparameter onjson(), anderror/stackTraceparameters onlog(). -
DevLog.jsonnow accepts alevel(defaults to the newLogLevel.json) and respectsminPrioritylike every other log.
Breaking changes:
-
DevLog.onLogchanged fromvoid Function(String message, String name)tovoid Function(LogRecord record). Errors and stack traces are no longer delivered as separate/ERRand/STKcalls; they are fields on the record. Migration:// Before DevLog.onLog = (message, name) => file.writeln('[$name] $message'); // After DevLog.onLog = (record) => file.writeln('[${record.name}] ${record.message}'); -
The
sourceSkipparameter was removed fromDevLog.log. The source location is now resolved automatically and stays correct through wrappers. -
DevLog.jsonprints the title and JSON body as a single log entry instead of two, and is filtered byminPriority(priorityinfoby default).
0.1.0 #
Initial release.
- Leveled colored logging:
info,success,warn,error,api,storage,ui. - Custom
LogLevelsupport withLogPriorityfor filtering. - Optional
[file:line]source location (DevLog.includeSource). errorandstackTraceparameters forwarded todart:developer.- Tagged logging (
tag:) and per-moduleDevLog.scoped()loggers. DevLog.minPriorityfilter andDevLog.lazy()for deferred messages.- Pretty JSON logging via
DevLog.json. - Pluggable output via
DevLog.onLog; debug-only by default.