Lighthouse Developer Guidebook
Share
Explore
Toolbox

icon picker
LogDaemon

toolbox/debugging/log_daemon/log_daemon.dart
HTTPLogger provides a logging interface that does not depend on third-party libraries and extensions, Flutter or Dart battery packages, or print statements. Open up a terminal (let's call this session 1), and type dart run. This will activate the Toolbox API. Take note of the host URL and port number. Back in the Flutter app, in main.dart, you’ll see that there is a line that looks like this:
final ToolboxConfigs tbConfigs = ToolboxConfigs.none();
Those are the settings for a production app. But now the app is in development mode, so we’re going to add some development configurations. Instead of the none constructor, we’re going to use the default one, and tell it where to find our Toolbox API:
ToolboxConfigs(hostUrl: <hostUrl>, port: <port>);
Now, we can use the tools from the Toolbox package by importing it directly where needed:
<import>
Now, we can send logs to our locally-hosted console:
tb.logger.log(“Some log”, this.build);
Which will show up almost instantly in the terminal from session 1:
<Image>

HTTPLogger

CONSTRUCTORS

HTTPLogger

Default constructor.

METHODS

log

void log(
String msg,
Object? src, [
level = 0,
tags = const [],
]) {}

PROPERTIES


Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.