Closed agordeev closed 4 years ago
Sorry, my bad. I'm unable to import FileOutput
in my console Dart app. It's just not visible to me. Seems like it's not exported properly.
That doesn't sound right. Could you provide me with some minimal example showing the behaviour? Or some code snippets? Thanks!
Simply try to import FileOutput
into your console app. That won't work.
Seems like the reason is in this line of logger.dart
:
export 'src/log_output.dart'
if (dart.library.io) 'src/outputs/file_output.dart';
I've looked into the issue and it is weird. I believe this has something to do with the Dart LSP server. The code as you wrote it works (but crashes because you didn't pass a File
instance). Only the IDE is confused. I'm sure it has something to do with the conditional import but this seems a rabbit hole I'm unwilling to touch ATM.
The correct call would be final fileLogger = Logger(output: FileOutput(file: File('/tmp/sheep.log')));
.
Lemme know if this works.
Hi all,
FileOutput
is not found for me. This shows red, but Logger is fine. Weird:
var logger = Logger(output: FileOutput(()));
Thanks.
I encountered this problem yesterday. Reading around it seems to require a -D constant being set to activate the import. It's unclear to me if this works in Dart 2.0. I worked around the problem by importing the implementation file and living with the subsequent warning.
Same issue here, we ended up rolling with our own implementation which isn't great.
Same problem.
[edit] solved it with
import 'package:logger/src/outputs/file_output.dart';
I'm not sure what is happening. Can you include some console output, or some other indication of what exactly is not working?