Package com.codingchili.core.logging
Class AbstractLogger
java.lang.Object
java.util.logging.Handler
com.codingchili.core.logging.AbstractLogger
- All Implemented Interfaces:
JsonLogger,Logger
- Direct Known Subclasses:
ConsoleLogger,RemoteLogger
Default logging implementation.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLogger(CoreContext context, Class aClass)AbstractLogger(Class aClass) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Shuts down the logger instance, frees any resources such as files or thread pools.Creates a logging event using the loggers level.Creates a logging event using a provided logger level.voidflush()log(io.vertx.core.json.JsonObject json)voidEmit when multiple attempts to initialize singleton.voidonCacheCleared(String component)Emit when the cache of a component has been cleared.voidonConfigurationDefaultsLoaded(String path, Class<?> clazz)Emit when a configuration was not found on disk and its defaults was loaded from memory.voidLog general errors.voidonFileLoaded(String path)Emit when a file has been loaded from the file-system.voidonFileLoadError(String fileName)Emit when failing to load specified fileName;voidonFileSaved(String saver, String path)Emit when a file has been saved to file.voidonFileSaveError(String fileName)Emit when error to save file.voidonHandlerMissing(String target, String route)Throw when a requested handler was not found.voidonInvalidConfigurable(Class<?> clazz)Throw when a configuration was not found and the attempt to instantiate default configuration from the given class has error.voidonListenerStarted(CoreListener listener)called when a listener is started.voidonListenerStopped(CoreListener listener)called when a listener is stopped.voidonMetricsSnapshot(io.vertx.core.json.JsonObject metrics)Send METRICS_ENABLED to the logger.voidonSecurityDependencyMissing(String target, String identifier)Emit when a property in the security configuration is misconfigured.voidonServiceFailed(Throwable cause)voidonServiceStarted(CoreService service)Emit when a new server has started.voidonServiceStopped(CoreService service)Emit when a server has stopped.voidonTimerSourceChanged(String name, int initialTimeout, int newTimeout)Emit when the interval of a periodic timer has changed.voidremoveMetadata(String nameOrKey)setMetadata(String name, Supplier<io.vertx.core.json.JsonObject> value)Sets a metadata value on the logger.setMetadataValue(String key, Supplier<String> value)Sets a metadata value on the logger.Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
Field Details
-
metadata
-
context
-
logger
-
aClass
-
-
Constructor Details
-
AbstractLogger
-
AbstractLogger
-
-
Method Details
-
log
- Specified by:
login interfaceJsonLogger- Parameters:
json- the data to be logged.- Returns:
- fluent
-
setMetadata
Description copied from interface:LoggerSets a metadata value on the logger.- Specified by:
setMetadatain interfaceLogger- Parameters:
name- a supplier to a metadata object that will be merged into the root node when an event is created..value- the dynamic metadata to add to log events.- Returns:
- fluent.
-
setMetadataValue
Description copied from interface:LoggerSets a metadata value on the logger.- Specified by:
setMetadataValuein interfaceLogger- Parameters:
key- the key to put the metadata value in.value- a supplier invoked when an event is created.- Returns:
- fluent.
-
removeMetadata
- Specified by:
removeMetadatain interfaceLogger- Parameters:
nameOrKey- removes metadata with a matching name or key.- Returns:
- fluent.
-
event
Description copied from interface:LoggerCreates a logging event using the loggers level. -
event
Description copied from interface:LoggerCreates a logging event using a provided logger level. -
onAlreadyInitialized
public void onAlreadyInitialized()Description copied from interface:LoggerEmit when multiple attempts to initialize singleton.- Specified by:
onAlreadyInitializedin interfaceLogger
-
onServiceStarted
Description copied from interface:LoggerEmit when a new server has started.- Specified by:
onServiceStartedin interfaceLogger- Parameters:
service- the service that was started
-
onServiceStopped
Description copied from interface:LoggerEmit when a server has stopped.- Specified by:
onServiceStoppedin interfaceLogger- Parameters:
service- the service that was stopped
-
onListenerStarted
Description copied from interface:Loggercalled when a listener is started.- Specified by:
onListenerStartedin interfaceLogger- Parameters:
listener- the listener that was started
-
onListenerStopped
Description copied from interface:Loggercalled when a listener is stopped.- Specified by:
onListenerStoppedin interfaceLogger- Parameters:
listener- the listener that was stopped
-
onServiceFailed
- Specified by:
onServiceFailedin interfaceLogger- Parameters:
cause- the reason why the name has failed.
-
onMetricsSnapshot
public void onMetricsSnapshot(io.vertx.core.json.JsonObject metrics)Description copied from interface:LoggerSend METRICS_ENABLED to the logger.- Specified by:
onMetricsSnapshotin interfaceLogger- Parameters:
metrics- a json object containing metrics data to be published
-
onHandlerMissing
Description copied from interface:LoggerThrow when a requested handler was not found.- Specified by:
onHandlerMissingin interfaceLogger- Parameters:
target- the target handlerroute- the route of the handler
-
onFileLoaded
Description copied from interface:LoggerEmit when a file has been loaded from the file-system.- Specified by:
onFileLoadedin interfaceLogger- Parameters:
path- a path to the loaded file.
-
onError
Description copied from interface:LoggerLog general errors. -
publish
-
onFileLoadError
Description copied from interface:LoggerEmit when failing to load specified fileName;- Specified by:
onFileLoadErrorin interfaceLogger- Parameters:
fileName- handler of the file that failed to load
-
onFileSaved
Description copied from interface:LoggerEmit when a file has been saved to file.- Specified by:
onFileSavedin interfaceLogger- Parameters:
saver- the component that saved the file.path- to the saved file.
-
onFileSaveError
Description copied from interface:LoggerEmit when error to save file.- Specified by:
onFileSaveErrorin interfaceLogger- Parameters:
fileName- handler of the entity that failed saving.
-
onConfigurationDefaultsLoaded
Description copied from interface:LoggerEmit when a configuration was not found on disk and its defaults was loaded from memory.- Specified by:
onConfigurationDefaultsLoadedin interfaceLogger- Parameters:
path- the path to the configurable that was not found.clazz- the class of the configurable.
-
onInvalidConfigurable
Description copied from interface:LoggerThrow when a configuration was not found and the attempt to instantiate default configuration from the given class has error.- Specified by:
onInvalidConfigurablein interfaceLogger- Parameters:
clazz- a class that is not of Configurable type.
-
onCacheCleared
Description copied from interface:LoggerEmit when the cache of a component has been cleared.- Specified by:
onCacheClearedin interfaceLogger- Parameters:
component- the handler of the component.
-
onSecurityDependencyMissing
Description copied from interface:LoggerEmit when a property in the security configuration is misconfigured.- Specified by:
onSecurityDependencyMissingin interfaceLogger- Parameters:
target- the handler of the target that is missing the requested property identifier.identifier- the secret that was requested
-
log
-
log
-
onTimerSourceChanged
Description copied from interface:LoggerEmit when the interval of a periodic timer has changed.- Specified by:
onTimerSourceChangedin interfaceLogger- Parameters:
name- handler of the timer that changed intervalinitialTimeout- the previous value of the intervalnewTimeout- the new interval of the timer
-
flush
public void flush() -
close
public void close()Description copied from interface:LoggerShuts down the logger instance, frees any resources such as files or thread pools.
-