Package com.jk.services.client.logging
Class JKLogServiceClient
java.lang.Object
com.jk.services.client.logging.JKLogServiceClient
This class provides a client interface for logging messages to the remote
logging service.
It allows you to log messages with different severity levels and send them to the remote logging microservice.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
ConstructorsConstructorDescriptionThis method constructs a new with the logging service base URL and initializes the client. -
Method Summary
Modifier and TypeMethodDescriptionvoid
callAddLog
(String message, String severity) This method logs a message with the specified severity level to the remote logging service.void
This method logs a debug-level message to the remote logging service.void
This method logs an error-level message to the remote logging service.void
This method logs an info-level message to the remote logging service.void
This method logs a trace-level message to the remote logging service.void
This method logs a warn-level message to the remote logging service.getAppLogCount
(String appName, boolean reset) This method retrieves the count of log entries for a specific application from the remote logging service.getAppLogs
(String appName, boolean reset) This method retrieves a list of log entries for a specific application from the remote logging service.static Boolean
THis method checks whether log messages should be sent asynchronously.static boolean
This method checks whether the logging service client is enabled based on the configuration.static void
setRunAsync
(Boolean runAsync) This method sets whether log messages should be sent asynchronously (true) or not (false).
-
Constructor Details
-
JKLogServiceClient
public JKLogServiceClient()This method constructs a new with the logging service base URL and initializes the client.- See Also:
-
-
Method Details
-
callTrace
This method logs a trace-level message to the remote logging service.- Parameters:
message
- Specifies the message to be logged.
-
callDebug
This method logs a debug-level message to the remote logging service.- Parameters:
message
- Specifies the message to be logged.
-
callInfo
This method logs an info-level message to the remote logging service.- Parameters:
message
- Specifies the message to be logged.
-
callWarn
This method logs a warn-level message to the remote logging service.- Parameters:
message
- Specifies the message to be logged.
-
callError
This method logs an error-level message to the remote logging service.- Parameters:
message
- Specifies the message to be logged.
-
callAddLog
This method logs a message with the specified severity level to the remote logging service.- Parameters:
message
- Specifies the message to be logged.severity
- Specifies the severity level of the log entry.
-
getAppLogCount
This method retrieves the count of log entries for a specific application from the remote logging service.- Parameters:
appName
- Specifies the name of the application for which log entries are counted.reset
- Indicates whether to reset the log count after retrieval (true) or not (false).- Returns:
- an integer representing the count of log entries for the specified application, or null if logging is not enabled.
-
getAppLogs
This method retrieves a list of log entries for a specific application from the remote logging service.- Parameters:
appName
- Specifies the name of the application for which log entries are retrieved.reset
- Indicates whether to reset the log count after retrieval (true) or not (false).- Returns:
- a list of
JKLog
objects representing the log entries for the specified application, or an empty list if logging is not enabled.
-
isEnabled
public static boolean isEnabled()This method checks whether the logging service client is enabled based on the configuration.- Returns:
- true, if the logging service client is enabled, false otherwise.
-
getRunAsync
THis method checks whether log messages should be sent asynchronously.- Returns:
- true, if the log messages should be sent asynchronously, false otherwise.
-
setRunAsync
This method sets whether log messages should be sent asynchronously (true) or not (false).- Parameters:
runAsync
- Indicates whether log messages should be sent asynchronously (true) or not (false).
-