Logger
Darto provides a built-in logger that can be used to log messages to the console. To use the log
helper to access methods, info
, warn
, debug
, access
, and error
.
Default Logger
Active logger by default to see the logs. like this:
[17:22:30.275] (INFO): Server listening at 0.0.0.0:8080
void main() {
final app = Darto(logger: true);
app.listen(3000);
}
Custom Logger
final app = Darto();
app.log.info("Hello World");
[17:22:30.275] (INFO): Hello World
Request and Response
The log
helper can be used to log request and response information.
app.get('/', (Request req, Response res) {
req.log.debug("Request received");
res.send("Hello World");
}
[17:22:30.275] (DEBUG): Request received
Last updated on