Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

logstage: handling of optional arguments

See original GitHub issue

Would it make sense to handle optional arguments like this:

val name = Option("myName")
val age = Option.empty[Int]"$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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

pshirshovcommented, Apr 5, 2020

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.

neko-kaicommented, Apr 3, 2020

@an-tex Definitely feel free to pursue this! Although do try to make it configurable as not everyone might want such behavior by default.

Read more comments on GitHub >

github_iconTop 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 A descriptive name for the node. Machine's hostname 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found