Package org.xwiki.logging.script
Class LoggingScriptService
- java.lang.Object
-
- org.xwiki.logging.script.LoggingScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("logging") @Singleton public class LoggingScriptService extends Object implements org.xwiki.script.service.ScriptServiceProvide logging related script oriented APIs.- Since:
- 4.2M3
- Version:
- $Id: fa33bd99210b474989898445126dfb98ae68b091 $
-
-
Constructor Summary
Constructors Constructor Description LoggingScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeprecate(String loggerName, String message)Log a deprecated message, only if theLoggerConfiguration.isDeprecatedLogEnabled()istrue.org.xwiki.logging.LogLevelgetLevel(String loggerName)Map<String,org.xwiki.logging.LogLevel>getLevels()org.slf4j.LoggergetLogger(String name)Return a logger named according to the name parameter.voidsetLevel(String logger, org.xwiki.logging.LogLevel level)org.xwiki.logging.LogTreetoLogTree(Iterable<org.xwiki.logging.event.LogEvent> logs)Create a tree representation of a series of logs.org.xwiki.logging.event.LogEventtranslate(org.xwiki.logging.event.LogEvent logEvent)Translate the passedLogEventbased on the translation message corresponding to the translation key stored in theLogEvent.org.xwiki.logging.Messagetranslate(org.xwiki.logging.Message message)Translate the passedMessagebased on the translation message corresponding to the translation key stored in theMessage.
-
-
-
Method Detail
-
getLogger
public org.slf4j.Logger getLogger(String name)
Return a logger named according to the name parameter.- Parameters:
name- The name of the logger.- Returns:
- logger
- Since:
- 6.1RC1
-
getLevels
public Map<String,org.xwiki.logging.LogLevel> getLevels()
- Returns:
- all the loggers (usually packages) with corresponding levels.
-
getLevel
public org.xwiki.logging.LogLevel getLevel(String loggerName)
- Parameters:
loggerName- the logger name (usually packages)- Returns:
- the level associated to the logger
-
setLevel
public void setLevel(String logger, org.xwiki.logging.LogLevel level)
- Parameters:
logger- the logger name (usually package)level- the level associated to the logger
-
toLogTree
public org.xwiki.logging.LogTree toLogTree(Iterable<org.xwiki.logging.event.LogEvent> logs)
Create a tree representation of a series of logs.- Parameters:
logs- the logs- Returns:
- the logs as a
LogTree - Since:
- 5.4RC1
-
translate
public org.xwiki.logging.event.LogEvent translate(org.xwiki.logging.event.LogEvent logEvent)
Translate the passedLogEventbased on the translation message corresponding to the translation key stored in theLogEvent.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} messagein order to modify the order of the argument which can be required depending on the language.- Parameters:
logEvent- theLogEventto translate- Returns:
- the translated version of the passed
LogEvent
-
translate
@Unstable public org.xwiki.logging.Message translate(org.xwiki.logging.Message message)
Translate the passedMessagebased on the translation message corresponding to the translation key stored in theMessage.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} messagein order to modify the order of the argument which can be required depending on the language.- Parameters:
message- theMessageto translate- Returns:
- the translated version of the passed
Message - Since:
- 15.0RC1, 14.10.1
-
deprecate
@Unstable public void deprecate(String loggerName, String message)
Log a deprecated message, only if theLoggerConfiguration.isDeprecatedLogEnabled()istrue. Note that the deprecated message is displayed as a warning with the[DEPRECATED]suffix.- Parameters:
loggerName- the name of the logger to be used for the deprecated message.message- the message to be displayed for explaining the deprecation.- Since:
- 13.1RC1
-
-