dev_log_client 0.2.2
dev_log_client: ^0.2.2 copied to clipboard
Flutter/Dart client for dev_log_viewer. Forwards logs to the local viewer with a Dio interceptor, AppLog shortcuts, and raw log sender.
Changelog #
0.2.2 #
- Discovery no longer gives up permanently when no server is found.
Previously, if the app started before
dev_log_viewerwas running, discovery failed once and all subsequentLogForwarder.send()calls were silently dropped for the lifetime of the session. Now discovery retries every 5 seconds so logs start flowing as soon as the server comes up, without restarting the app. Buffered startup entries are preserved across retries and delivered on the first successful connection. LogForwarder.send()is now a no-op in release builds. The_kDebugModeguard was missing fromsend(), so in release builds entries accumulated in the pending buffer indefinitely (up to 200, then oldest were dropped).init()was already guarded;send()now matches.- Discovery now prefers the most recently started server when no project name matches, instead of always picking the lowest port. This fixes the common case where port 8181 is occupied by a stale viewer from a previous session and the new server starts on 8182 — the right server now wins.
- Discovery ignores ports that don't look like a dev_log_viewer. Ports
are now fingerprinted by checking that the ping response includes
status: 'ok'and echoes back the correct port number, so unrelated services that happen to return JSON from/pingare no longer mistaken for a viewer. - Copy button now includes body and error for API error entries. The
error message format sent by
DevLogInterceptor.onErrorchanged fromGET url → 404 · msto<-- 404 url · ms(consistent with success responses) so the viewer's copy function can parse it correctly. - iOS example: added
NSAllowsLocalNetworkingATS exception so HTTP connections tolocalhostare not blocked on iOS 26+.
0.2.1 #
- Startup logs are no longer silently dropped. Entries sent via
LogForwarder.send()before port discovery completes are now buffered (up to 200) and flushed to the server once discovery succeeds. Discovery can take a few hundred milliseconds (ping timeouts), so anything logged duringmain()startup would previously vanish with no error or trace. LogForwarder.send()now captures the timestamp at call time rather than at HTTP post time — buffered entries show the correct event time, not the time they were flushed.
0.2.0 #
LogForwarder.init()now accepts an optionalprojectparameter. Auto-detecting the project name by readingpubspec.yamlonly ever worked on desktop/CLI targets — on iOS/Android the app runs sandboxed with no such file on disk, so discovery silently fell back to "lowest port wins." Passprojectexplicitly on mobile:LogForwarder.init(project: 'my_app');- Discovery no longer connects to whichever server answers first. It pings
every candidate port (8181–8185) concurrently via the side-effect-free
/pingendpoint, then prefers a server reporting the same project, picking the most recently started one among those. Previously a stale server from a previous run (or a different project) on a lower port would win the race every time. DevLogInterceptorrequest/response/error bodies are sent unredacted — this is a localhost-only, debug-only tool, and the point is being able to inspect (and copy) real request/response data while debugging. The viewer UI masks sensitive fields by default and reveals them on click instead.
0.1.1 #
- Documentation only — dartdoc comments added across the public API, no behavioural changes.
0.1.0 #
- Initial release.
LogForwarder— raw log sender with auto-discovery across ports 8181–8185.DevLogInterceptor— zero-config Dio interceptor for automatic API traffic logging.AppLog— named tag shortcuts (auth,nav,store,api,error,log).- All output suppressed automatically in release builds via
dart.vm.product.