logstage: handling of optional arguments
See original GitHub issueWould it make sense to handle optional arguments like this:
val name = Option("myName")
val age = Option.empty[Int]
izLogger.info(s"$name $age")
currently prints
name=Some(myName) age=None
how about having it just print
name=myName
My usecase is a rate-logger with an optional “total” argument, so the log looks either like:
- no known total:
rate=8/s done=14
- with known total:
rate=8/s done=14 left=238 donePercent=5%
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
LogStage - Izumi Project
LogStage is a zero-cost structural logging framework for Scala & Scala.js ... print result without a name logger.warn(s"Invisible argument: ${Random.
Read more >Logstash optional fields in logfile - regex - Stack Overflow
I'm using match like this: match => [ "message", "%{NUMBER:requestId},%{WORD:ServerHost},%{WORD:Service}, ... My question is: Can I allow ...
Read more >Python best practice when logging optional arguments
I have a method that accepts one or more optional arguments and I'd like to log them, following the best practice of lazy...
Read more >logstash.yml | Logstash Reference [8.5] - Elastic
Setting Description Default value
node.name A descriptive name for the node. Machine's hostname
pipeline.id The ID of the pipeline. main
pipeline.workers Number of the host's CPU...
Read more >Centralized log management (Graylog, Logstash, Fluentd)
This can become tricky if you use log parameters (which are included by default), or if you enable MDC inclusion (disabled by default),...
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
I think this should be implemented at rendering policy level.
For json policy this can be achieved by customising circe’s Printer (there is an option to skip nulls), for string policy we may add a parameter for this.
Also there is an argument flag to suppress argument names, we may add one more flag (or turn existing one into an ADT) so we may adjust None/null suppression at for each individual argument.
@an-tex Definitely feel free to pursue this! Although do try to make it configurable as not everyone might want such behavior by default.