logging icon indicating copy to clipboard operation
logging copied to clipboard

Add a log parameter for Metadata information

Open feinstein opened this issue 3 years ago • 4 comments

Many logging tools log Metadata with the traditional message, error and stack trace logs. Datadog is an example, it accepts a parameter called attributes, which is a json Map where you can send anything you want with your logs.

Crashlytics have an information field that usually uses FlutterErrorDetails.informationCollector to provide more data to the logs.

My project uses this library to route all the logs from the whole app to one central location, then we distribute the logs to Crashlytics and Datadog, but since the library doesn't have a parameter for Metadata we are losing depth on our logs.

My suggestion is that we add a Metadata parameter to the LogRecord and the log functions, to enrich the logs we can generate.

feinstein avatar Jun 16 '22 16:06 feinstein

Can I work on this issue?

AmanNegi avatar Sep 01 '22 18:09 AmanNegi

Why not to use Expando to pass metadata with log record? I may be cumbersome, but compatible and doesn't require changing public API, it may even be implemented via extensions.

Zekfad avatar Apr 18 '23 17:04 Zekfad

Because besides being very cumbersome, making the log code harder to read, it will also won't work of you are logging strings, since you can't expand a string.

feinstein avatar Apr 18 '23 18:04 feinstein

That would be really useful to have this indeed, I'm currently implement remote logging with Google Cloud Logging for my Dart backend and I really miss a metadata attributes in order to send proper information to Cloud Logging

jaumard avatar Aug 15 '24 13:08 jaumard