dart-lang / core

This repository is home to core Dart packages.
https://pub.dev/publishers/dart.dev
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

logging: provide LogRecord formatting #416

Open DartBot opened 9 years ago

DartBot commented 9 years ago

Issue by seaneagan Originally opened as dart-lang/sdk#12030


The logging package should provide support for converting LogRecords into Strings.

In Java's logback these are called Layouts:

http://logback.qos.ch/manual/layouts.html

For example:

class LogFormat {   String format(LogRecord record); }

Then can use it like so:

logger.onRecord.map(logFormat.format)

DartBot commented 9 years ago

Comment by madsager


cc @sigmundch. cc @gramster. Added Area-Library, Triaged labels.

DartBot commented 9 years ago

Comment by lrhn


Removed Type-Defect label. Added Type-Enhancement, Library-Logging labels.

DartBot commented 9 years ago

Comment by lrhn


Removed Area-Library label. Added Area-Pkg label.

DartBot commented 9 years ago

Comment by anders-sandholm


Removed Library-Logging label. Added Pkg-Logging label.

allentv commented 4 years ago

There are other issues that are pointing to this. Can one of the core maintainers specify a list of features that requires implementation so that someone can work on them?

allentv commented 4 years ago

Logs from apps running on cloud services like GCP Logging, are usually expected to be in a structured format. So having the ability to use custom formatters for logs would be helpful for parsing and setting alerts.

natebosch commented 4 years ago

Can one of the core maintainers specify a list of features that requires implementation so that someone can work on them?

I don't think we have done that level of triaging, and I'm not sure we'll realistically be able to any time soon.

having the ability to use custom formatters for logs would be helpful for parsing and setting alerts.

There are not any blockers to you defining custom formatters. The main question is whether there are formats that are universal enough to warrant shipping in the shared package. So far I'm not convinced there are - I don't think we could define a format that enough folks would want to make it worth defining here instead of defining elsewhere. It would also be easy for someone to write an external package like package:log_format that exposes one or more String Function(LogRecord) for reuse.