Skip to content

parameterized logging? #131

@burak

Description

@burak

Hi,

Short summary:

Instead of

DEBUG "Got here with " . $foo;

or even

DEBUG "Got here with " . Dumper $foo;

or even

DEBUG sprintf "Got here with %s", Dumper $foo;

It might be nicer to have a

DEBUG "Got here with {} and then {} and even {}", $foo, $bar, $baz;

This is actually a slf4j feature, but I think that it is quite a handy functionality to have (scroll down in the linked doc).

https://www.slf4j.org/faq.html#logging_performance

Implementation details:

https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java

The functionality boils down to replacing "{}" with the parameter list. It is akin to sprintf "%s" and for the reference parameters, Data::Dumper can be utilized as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions