JSLogBuilder
Overview
The JSLogBuilder
class facilitates constructing and logging events with support for exceptions and parameterized messages. It integrates with the logging framework and is instantiated through JSLogger
methods. The class supports adding exceptions to log events, including Throwable
and JavaScript's NativeError
. Developers can log messages with or without additional parameters, using flexible formatting. When handling NativeError
objects, it extracts properties like name, message, and stack trace for inclusion in the log. Additionally, it provides functionality to log events without a message, making it suitable for error-only logging scenarios. The logging level is preserved as part of the instance for potential configuration or usage.
Methods Summarized
void
Logs an event without adding a message.
void
Logs a message with or without parameters.
Includes an exception in the log event.
Methods Detailed
log()
Logs an event without adding a message. This can be useful in combination with withException(e) if no message is required.
Returns: void
Sample
log(message, params)
Logs a message with or without parameters.
Parameters
Returns: void
Sample
withException(exception)
Includes an exception in the log event.
Parameters
Sample
Last updated
Was this helpful?