[Parser]: Custom LogLevels
See original GitHub issueFeature Request
It would be great to overwrite the log levels.
Describe the solution you’d like
A way to overwrite the log levels for printing. The methods should stay the same, just the print would change.
Teachability, Documentation, Adoption, Migration Strategy
Example from Pino using nestjs-pino
return LoggerModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService<Configuration>) => {
const severityLookup: Record<string, string> = {
default: 'DEFAULT',
silly: 'DEFAULT',
verbose: 'DEBUG',
debug: 'DEBUG',
http: 'INFO',
info: 'INFO',
warn: 'WARNING',
error: 'ERROR',
};
return {
pinoHttp: {
formatters: {
level(label, number) {
return { severity: severityLookup[label], level: number };
},
},
},
};
},
inject: [ConfigService],
});
What is the motivation / use case for changing the behavior?
Some cloud providers require certain log levels for their log collectors to pick it up properly. See Googles log levels as an example.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Global Log Levels - LogViewPlus
In LogViewPlus, this is achieved by configuring parser specific Local Log Levels. Local log levels take precedence over global log levels.
Read more >Process custom log levels - Grafana Loki
Hi, I'm starting with Loki in a docker environment. Logs are already transmitted to loki using the loki docker driver.
Read more >Parse-server: Set logLevel - Stack Overflow
In the latest version of parse-server, the default logLevel seem to be "info", which logs all cloud code functions.
Read more >LogLevel Enum (Microsoft.Extensions.Logging)
Learn how to implement a custom logging provider in your .NET applications. ILogger Interface (Microsoft.Extensions.Logging). Represents a type used to perform ...
Read more >Support custom log levels for standard library logging module
Steps to reproduce: Configure a custom Python log level with logging.addLevelName and configure google-cloud-logging . · Code example.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ogma/logger
2.0.0 was released yesterday. This is included in functionality of itI think I could make some sort of
special
ororiginalLevel
property on the JSON work. I’d be concerned about it adding more clutter to the JSON, but usually devs aren’t looking at raw JSON anyways, so I don’t think it should be too big a deal. Maybe some sort ofool
(Ogma original level) to keep the key short.