[slf4j-dev] [JIRA] Updates for SLF4J-124: Add ability to log at a dynamic level

QOS.CH (JIRA) noreply-jira at qos.ch
Tue Jun 29 23:13:00 CEST 2021


SLF4J / SLF4J-124 [In Progress]
Add ability to log at a dynamic level

==============================

Here's what changed in this issue in the last few minutes.

There is 1 comment.

View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-124

==============================
 1 comment
------------------------------

Ceki Gülcü on 29/Jun/21 10:58 PM
The 2.0 API introduces a new method, namely {{Logger.makeLoggingEventBuilder(Level)}} which an be used to accomplish the desired outcome.

Example code:
{code:java}
public void logAMessageAtGivenLevel(Level aLevel, String aMessage) {
  Logger logger = .. // some slf4j logger of choice
  logger.makeLoggingEventBuilder(aLevel).log(aMessage);
}
{code}

The default implementation will return a NOPLoggingEventBuilder if the logger is disabled for the given Level.



==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the slf4j-dev mailing list