Reputation: 61
I just cannot figure out how to show logging messages when running dart files from terminal.
example.dart
:import 'dart:developer';
void main() {
print('print');
log('log');
}
log
I tried calling dart example.dart
, dart run --all example.dart
, dart run --verbosity=all example.dart
, and different values instead of all
(info
, ...).
But non of these produced any helpful error messages let alone the out print I expect.
Upvotes: 1
Views: 192
Reputation: 89946
APIs from dart:developer
(such as log
) are intended to interact with debugging tools:
Interact with developer tools such as the debugger and inspector.
It's not explicit from the documentation for log
, but I'd expect it to send a log message only to an attached debugger, not to the console.
If you want logging output that is independent of a debugger, use package:logging
and add a listener that calls print
, as shown by the example.
Upvotes: 1