logging icon indicating copy to clipboard operation
logging copied to clipboard

logging: provide LogRecord formatting

Open DartBot opened this issue 9 years ago • 7 comments

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="96" height="96"hspace="10"> 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 avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/2909286?v=3" align="left" width="48" height="48"hspace="10"> Comment by madsager


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

DartBot avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/4865287?v=3" align="left" width="48" height="48"hspace="10"> Comment by lrhn


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

DartBot avatar Jun 05 '15 22:06 DartBot

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 avatar May 10 '20 19:05 allentv

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.

allentv avatar May 10 '20 19:05 allentv

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.

natebosch avatar May 14 '20 01:05 natebosch