The IP address of the browser.
The IP address of the browser. Used with the ipRegex option of loggers and appenders.
Default url used by ajax appenders when no url is set.
Default url used by ajax appenders when no url is set.
Provides the default url if no url is set on the AjaxAppender setOptions Method. Also sets the url for the default appender.
If defaultAjaxUrl is not set, the url /jsnlog.logger is used.
Sets a beforeSend method for all Ajax Appenders.
Sets a beforeSend method for all Ajax Appenders.
The beforeSend field lets you set a function that is called right before an AJAX request with log messages is sent to the server. It receives these parameters:
xhr XMLHttpRequest object used to send the request. Allows you to for example add your own request headers. json Message to be sent. Allows you to modify this message before it is sent. See below.
If false, all loggers are disabled.
If false, all loggers are disabled.
Limits total number of messages sent to the server.
Limits total number of messages sent to the server.
You use maxMessages to limit the number of messages sent to the server. When you set maxMessages via a call to setOptions, a counter is set to maxMessages. Each time messages are sent to the server, that counter is decremented by the number of messages sent. When the counter gets to zero or below, no more messages will be sent.
However, this is affected by batching and buffering.
Take a situation where maxMessages is set to 5 and 2 messages have already been sent - so the message counter is now 3. If 8 messages had been stored in a buffer and those messages are now sent, they will be all sent. That means the server will receive a total of 2 + 8 = 10 messages. After this, no more messages will be sent, because the number of messages sent (10) exceeds maxMessages (5).
This means that maxMessages is not a precise limit on the number of messages sent to the server. On the other hand, buffered messages are sent together in a single request to the server, minimizing bandwidth. And buffered messages are often useful in solving exceptions, so there is value in receiving them.
Sent with all log messages to the server, so make it easier to identify all log messages for a given request (details).
Sent with all log messages to the server, so make it easier to identify all log messages for a given request (details).
Method used to turn objects into strings.
Method used to turn objects into strings.
When you log an object, it needs to be turned into a string. This field lets you set the method used to do this.
If you do not set this field, by default the standard method JSON.stringify is used.
Your method has to take the object as a parameter and return the string:
serialize(object: any): string
A major reason to use your own method is to deal with objects with cyclic references. That is, objects that refer to themselves (details).
Set options on the library as a whole, typically during initialization.