Package com.codingchili.core.logging
Interface Logger
- All Superinterfaces:
JsonLogger
- All Known Implementing Classes:
AbstractLogger
,ConsoleLogger
,LoggerMock
,RemoteLogger
,StringLogger
Interface to generate logging messages.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.void
Emit when multiple attempts to initialize singleton.void
onCacheCleared(String component)
Emit when the cache of a component has been cleared.void
onConfigurationDefaultsLoaded(String path, Class<?> clazz)
Emit when a configuration was not found on disk and its defaults was loaded from memory.void
Log general errors.void
onFileLoaded(String path)
Emit when a file has been loaded from the file-system.void
onFileLoadError(String fileName)
Emit when failing to load specified fileName;void
onFileSaved(String component, String path)
Emit when a file has been saved to file.void
onFileSaveError(String fileName)
Emit when error to save file.void
onHandlerMissing(String target, String route)
Throw when a requested handler was not found.void
onInvalidConfigurable(Class<?> clazz)
Throw when a configuration was not found and the attempt to instantiate default configuration from the given class has error.void
onListenerStarted(CoreListener listener)
called when a listener is started.void
onListenerStopped(CoreListener listener)
called when a listener is stopped.void
onMetricsSnapshot(io.vertx.core.json.JsonObject metrics)
Send METRICS_ENABLED to the logger.void
onSecurityDependencyMissing(String target, String identifier)
Emit when a property in the security configuration is misconfigured.void
onServiceFailed(Throwable cause)
void
onServiceStarted(CoreService service)
Emit when a new server has started.void
onServiceStopped(CoreService service)
Emit when a server has stopped.void
onTimerSourceChanged(String name, int initial, int interval)
Emit when the interval of a periodic timer has changed.removeMetadata(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 interface com.codingchili.core.logging.JsonLogger
log
-
Method Details
-
event
Creates a logging event using the loggers level.- Parameters:
name
- the name of the event.- Returns:
- a LogMessage with a generated event, level, timestamp and context.
-
event
Creates a logging event using a provided logger level.- Parameters:
name
- the name of the event.level
- the level.- Returns:
- a LogMessage with a generated event, level, timestamp and context.
-
onAlreadyInitialized
void onAlreadyInitialized()Emit when multiple attempts to initialize singleton. -
onFileLoadError
Emit when failing to load specified fileName;- Parameters:
fileName
- handler of the file that failed to load
-
onMetricsSnapshot
void onMetricsSnapshot(io.vertx.core.json.JsonObject metrics)Send METRICS_ENABLED to the logger.- Parameters:
metrics
- a json object containing metrics data to be published
-
onHandlerMissing
Throw when a requested handler was not found.- Parameters:
target
- the target handlerroute
- the route of the handler
-
onFileLoaded
Emit when a file has been loaded from the file-system.- Parameters:
path
- a path to the loaded file.
-
onConfigurationDefaultsLoaded
Emit when a configuration was not found on disk and its defaults was loaded from memory.- Parameters:
path
- the path to the configurable that was not found.clazz
- the class of the configurable.
-
onInvalidConfigurable
Throw when a configuration was not found and the attempt to instantiate default configuration from the given class has error.- Parameters:
clazz
- a class that is not of Configurable type.
-
onCacheCleared
Emit when the cache of a component has been cleared.- Parameters:
component
- the handler of the component.
-
onFileSaved
Emit when a file has been saved to file.- Parameters:
component
- the component that saved the file.path
- to the saved file.
-
onFileSaveError
Emit when error to save file.- Parameters:
fileName
- handler of the entity that failed saving.
-
onError
Log general errors.- Parameters:
cause
- the cause for throw.
-
onTimerSourceChanged
Emit when the interval of a periodic timer has changed.- Parameters:
name
- handler of the timer that changed intervalinitial
- the previous value of the intervalinterval
- the new interval of the timer
-
onSecurityDependencyMissing
Emit when a property in the security configuration is misconfigured.- Parameters:
target
- the handler of the target that is missing the requested property identifier.identifier
- the secret that was requested
-
onServiceStarted
Emit when a new server has started.- Parameters:
service
- the service that was started
-
onServiceStopped
Emit when a server has stopped.- Parameters:
service
- the service that was stopped
-
onServiceFailed
- Parameters:
cause
- the reason why the name has failed.
-
onListenerStarted
called when a listener is started.- Parameters:
listener
- the listener that was started
-
onListenerStopped
called when a listener is stopped.- Parameters:
listener
- the listener that was stopped
-
setMetadataValue
Sets a metadata value on the logger.- Parameters:
key
- the key to put the metadata value in.value
- a supplier invoked when an event is created.- Returns:
- fluent.
-
setMetadata
Sets a metadata value on the logger.- 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.
-
removeMetadata
- Parameters:
nameOrKey
- removes metadata with a matching name or key.- Returns:
- fluent.
-
close
void close()Shuts down the logger instance, frees any resources such as files or thread pools. -
log
- Parameters:
line
- the text line to be logged.- Returns:
- fluent
-
log
- Parameters:
line
- the text line to be logged.level
- the logging level to log with.- Returns:
- fluent
-