Package fr.diskmth.loggy
Class Loggy
java.lang.Object
fr.diskmth.loggy.Loggable
fr.diskmth.loggy.Loggy
This class extends Loggable and provides logging functionality through a logger object from the java.util.logging package.
- Since:
- Loggy 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Loggy object with a specified name and a default formatter.Loggy(String name, LoggyFormatter formatter) Constructs a Loggy object with a specified name and formatter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddLogsFiles(LoggyFile... files) Adds specified log files to the logger's handlers.protected StringbuildStackTrace(Throwable thrown) Builds a stack trace from a Throwable object.getName()Returns the logger's name.log(String message, LoggyLevel level, LoggyFile... files) Logs a message with a specified level and log files.log(String message, Throwable thrown, LoggyLevel level, LoggyFile... files) Logs a message with a specified level and log files.log(Throwable thrown, LoggyLevel level, LoggyFile... files) Logs a Throwable object with a specified level and log files.protected voidremoveLogsFiles(LoggyFile... files) Removes specified log files from the logger's handlers.Methods inherited from class fr.diskmth.loggy.Loggable
getFormatter, isMuted, setFormatter, toggleMute
-
Field Details
-
logger
-
-
Constructor Details
-
Loggy
Constructs a Loggy object with a specified name and formatter.- Parameters:
name- the name of the loggerformatter- the formatter used to format log messages- Throws:
IllegalArgumentException- if the logger name is null or empty
-
Loggy
Constructs a Loggy object with a specified name and a default formatter.- Parameters:
name- the name of the logger
-
-
Method Details
-
addLogsFiles
Adds specified log files to the logger's handlers.- Parameters:
files- the log files to add
-
removeLogsFiles
Removes specified log files from the logger's handlers.- Parameters:
files- the log files to remove
-
buildStackTrace
Builds a stack trace from a Throwable object.- Parameters:
thrown- the Throwable object- Returns:
- the stack trace
-
log
Logs a message with a specified level and log files.- Parameters:
message- the message to logthrown- the Throwable object to loglevel- the level of the messagefiles- the log files to log the message in- Returns:
- the Loggy object
-
log
Logs a message with a specified level and log files.- Parameters:
message- the message to loglevel- the level of the messagefiles- the log files to log the message in- Returns:
- the Loggy object
-
log
Logs a Throwable object with a specified level and log files.- Parameters:
thrown- the Throwable object to loglevel- the level of the messagefiles- the log files to log the message in- Returns:
- the Loggy object
-
getName
Returns the logger's name.- Returns:
- the logger's name
-