@Component @Named(value="logging") @Singleton public class LoggingScriptService extends Object implements org.xwiki.script.service.ScriptService
Constructor and Description |
---|
LoggingScriptService() |
Modifier and Type | Method and Description |
---|---|
void |
deprecate(String loggerName,
String message)
Log a deprecated message, only if the
LoggerConfiguration.isDeprecatedLogEnabled() is true . |
org.xwiki.logging.LogLevel |
getLevel(String loggerName) |
Map<String,org.xwiki.logging.LogLevel> |
getLevels() |
org.slf4j.Logger |
getLogger(String name)
Return a logger named according to the name parameter.
|
void |
setLevel(String logger,
org.xwiki.logging.LogLevel level) |
org.xwiki.logging.LogTree |
toLogTree(Iterable<org.xwiki.logging.event.LogEvent> logs)
Create a tree representation of a series of logs.
|
org.xwiki.logging.event.LogEvent |
translate(org.xwiki.logging.event.LogEvent logEvent)
Translate the passed
LogEvent based on the translation message corresponding to the translation key
stored in the LogEvent . |
public org.slf4j.Logger getLogger(String name)
name
- The name of the logger.public Map<String,org.xwiki.logging.LogLevel> getLevels()
public org.xwiki.logging.LogLevel getLevel(String loggerName)
loggerName
- the logger name (usually packages)public void setLevel(String logger, org.xwiki.logging.LogLevel level)
logger
- the logger name (usually package)level
- the level associated to the loggerpublic org.xwiki.logging.LogTree toLogTree(Iterable<org.xwiki.logging.event.LogEvent> logs)
logs
- the logsLogTree
public org.xwiki.logging.event.LogEvent translate(org.xwiki.logging.event.LogEvent logEvent)
LogEvent
based on the translation message corresponding to the translation key
stored in the LogEvent
.
The translation message pattern use the same syntax than standard message pattern except that it's optionally
possible to provide a custom index as in Some {1} translation {0} message
in order to modify the
order of the argument which can be required depending on the language.
logEvent
- the LogEvent
to translateLogEvent
@Unstable public void deprecate(String loggerName, String message)
LoggerConfiguration.isDeprecatedLogEnabled()
is true
.
Note that the deprecated message is displayed as a warning with the [DEPRECATED]
suffix.loggerName
- the name of the logger to be used for the deprecated message.message
- the message to be displayed for explaining the deprecation.Copyright © 2004–2021 XWiki. All rights reserved.