Class LoggerFactory
- java.lang.Object
 - 
- io.gitlab.rychly.gphotos_uploader.logger.LoggerFactory
 
 
- 
public final class LoggerFactory extends java.lang.Object 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLoggerFactory.ConsoleFormatter 
- 
Field Summary
Fields Modifier and Type Field Description static java.util.logging.LevelDEFAULT_CONSOLE_LOG_LEVELstatic java.util.logging.LevelDEFAULT_FILE_LOG_LEVELstatic java.lang.StringHANDLER_ENCODINGstatic java.text.DateFormatTEMP_LOG_FILE_DATE_FORMATstatic java.lang.StringTEMP_LOG_FILE_PATTERNstatic java.util.logging.LoggerTOP_LOGGER 
- 
Constructor Summary
Constructors Constructor Description LoggerFactory() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.logging.HandleraddAnsiConsoleHandler()Create a new ANSI console handler with the default log messages level and add it to the bottom logger.static java.util.logging.HandleraddAnsiConsoleHandler(java.util.logging.Level level)Create a new ANSI console handler with a given log messages level and add it to the bottom logger.static java.util.logging.HandleraddFileHandler(java.lang.String fileNamePattern)Create a new file handler with the default log messages level and add it to the bottom logger.static @Nullable java.util.logging.HandleraddFileHandler(java.lang.String fileNamePattern, java.util.logging.Level level)Create a new file handler with a given log messages level and add it to the bottom logger.static java.util.logging.HandleraddHandler(java.util.logging.Handler handler, java.util.logging.Level level)Add a given log handler to the current bottom logger and set a given log messages level to the handler.static java.util.logging.LoggerappendLogger(java.lang.String loggerName)Create a new logger with a given name and ALL log messages level and append it to the logger hierarchy as the new bottom logger.static voiddemoLog(@NotNull java.util.logging.Logger logger)static java.lang.StringdumpObjectToString(java.lang.Object object)Recursively dump object's attributes to a string.static java.util.logging.LoggergetLogger()Get the getLogger.static booleaninit(java.lang.String loggerName)Create a new top logger with a given name and ALL log messages level.static java.util.logging.LevelloggingLevelForVerbosity(int verbosity)Translate a given numerical verbosity level into the log level.static voidmain(java.lang.String[] args)static @NotNull java.lang.StringtempLogFilePatternForName(java.lang.String baseName)Get the temp log file pattern for a given base name. 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_CONSOLE_LOG_LEVEL
public static final java.util.logging.Level DEFAULT_CONSOLE_LOG_LEVEL
 
- 
DEFAULT_FILE_LOG_LEVEL
public static final java.util.logging.Level DEFAULT_FILE_LOG_LEVEL
 
- 
TEMP_LOG_FILE_PATTERN
public static final java.lang.String TEMP_LOG_FILE_PATTERN
- See Also:
 - Constant Field Values
 
 
- 
TOP_LOGGER
public static final java.util.logging.Logger TOP_LOGGER
 
- 
HANDLER_ENCODING
public static final java.lang.String HANDLER_ENCODING
- See Also:
 - Constant Field Values
 
 
- 
TEMP_LOG_FILE_DATE_FORMAT
public static final java.text.DateFormat TEMP_LOG_FILE_DATE_FORMAT
 
 - 
 
- 
Method Detail
- 
init
public static boolean init(java.lang.String loggerName)
Create a new top logger with a given name and ALL log messages level.- Parameters:
 loggerName- a name of the new logger (the last part of the logger hierarchy)- Returns:
 trueif the logger has been created,falsethe logger cloud not be created as there is already a top logger
 
- 
appendLogger
public static java.util.logging.Logger appendLogger(java.lang.String loggerName)
Create a new logger with a given name and ALL log messages level and append it to the logger hierarchy as the new bottom logger.- Parameters:
 loggerName- a name of the new logger (the last part of the logger hierarchy)- Returns:
 - the new logger
 
 
- 
getLogger
@Contract(pure=true) public static java.util.logging.Logger getLogger()
Get the getLogger.- Returns:
 - the getLogger
 
 
- 
addHandler
@Contract("_, _ -> param1") public static java.util.logging.Handler addHandler(java.util.logging.Handler handler, java.util.logging.Level level)Add a given log handler to the current bottom logger and set a given log messages level to the handler.- Parameters:
 handler- the handler to addlevel- the log message level to set to the handler- Returns:
 - the added handler
 
 
- 
addAnsiConsoleHandler
public static java.util.logging.Handler addAnsiConsoleHandler()
Create a new ANSI console handler with the default log messages level and add it to the bottom logger.- Returns:
 - the new handler
 
 
- 
addAnsiConsoleHandler
public static java.util.logging.Handler addAnsiConsoleHandler(java.util.logging.Level level)
Create a new ANSI console handler with a given log messages level and add it to the bottom logger.- Parameters:
 level- the level of log messages for the handler- Returns:
 - the new handler
 
 
- 
addFileHandler
public static java.util.logging.Handler addFileHandler(java.lang.String fileNamePattern)
Create a new file handler with the default log messages level and add it to the bottom logger.- Parameters:
 fileNamePattern- the name pattern of the output file- Returns:
 - the new handler or 
nullif the handler could not be added 
 
- 
addFileHandler
@Nullable public static @Nullable java.util.logging.Handler addFileHandler(java.lang.String fileNamePattern, java.util.logging.Level level)Create a new file handler with a given log messages level and add it to the bottom logger.- Parameters:
 fileNamePattern- the name pattern of the output filelevel- the level of log messages for the handler- Returns:
 - the new handler
 
 
- 
loggingLevelForVerbosity
@Contract(pure=true) public static java.util.logging.Level loggingLevelForVerbosity(int verbosity)
Translate a given numerical verbosity level into the log level.- Parameters:
 verbosity- the verbosity level number- Returns:
 - the corresponding log level
 
 
- 
tempLogFilePatternForName
@NotNull @Contract(pure=true) public static @NotNull java.lang.String tempLogFilePatternForName(java.lang.String baseName)
Get the temp log file pattern for a given base name.- Parameters:
 baseName- the base name- Returns:
 - the resulting temp log file pattern
 
 
- 
dumpObjectToString
public static java.lang.String dumpObjectToString(java.lang.Object object)
Recursively dump object's attributes to a string.- Parameters:
 object- the object to dump- Returns:
 - the resulting string dump
 
 
- 
demoLog
public static void demoLog(@NotNull @NotNull java.util.logging.Logger logger) 
- 
main
public static void main(java.lang.String[] args) throws java.io.IOException- Throws:
 java.io.IOException
 
 - 
 
 -