-
<private> _onError()
-
Logs the errors that have occurred. Its signature matches that of `window.onerror`.
Will replace the `window.onerror`. It will still call the original `window.onerror`
as well if it existed.
- Source:
-
addAppender(logAppender)
-
Adds the specified logAppender to existing appenders for logging.
Parameters:
| Name |
Type |
Description |
logAppender |
function
|
Log appender for gather log data. |
- Source:
Example
Canadarm.addAppender(Canadarm.Appender.standardLogAppender);
-
addHandler(logHandler)
-
Adds the specified logHandler to existing handlers for logging.
Parameters:
| Name |
Type |
Description |
logHandler |
function
|
Log handler for logs. |
- Source:
Example
Canadarm.addHandler(Canadarm.Handler.consoleLogHandler);
Canadarm.addHandler(Canadarm.Handler.beaconLogHandler('http://example.com/beacon.gif'));
-
<private> customLogEvent(level)
-
Used to generate our custom loggers.
Parameters:
| Name |
Type |
Description |
level |
string
|
The level to log the events. |
- Source:
Returns:
a function that logs what is passed. Signature is: message, exception, data, settings.
-
fixedEncodeURIComponent(str)
-
Parameters:
| Name |
Type |
Description |
str |
string
|
The string to encode |
- Source:
-
<private> gatherErrors(level, exception, message, data, appenders)
-
Used to gather the errors that have occurred. This function loops over the existing
logAppenders and creates the attributes that will be logged to the errors. Returns
an object of errors to log.
Parameters:
| Name |
Type |
Description |
level |
string
|
Log level of the exception. (e.g. ERROR, FATAL) |
exception |
error
|
JavaScript Error object. |
message |
string
|
Message of the error. |
data |
object
|
Key/Value pairing of additional properties to log. |
appenders |
array
|
If passed will override existing appenders and be used. |
- Source:
-
init(settings)
-
Used to setup Canadarm for consumers. The properties below are for the settings
object passed to the init function.
Parameters:
| Name |
Type |
Description |
settings |
object
|
options for setting up canadarm. |
Properties:
| Name |
Type |
Description |
settings[onError] |
boolean
|
True, Canadarm will set onerror. Defaults to true. |
settings[wrapEvents] |
boolean
|
True, Canadarm will wrap event binding. Defaults to true. |
settings[appenders] |
Array
|
Array of Appenders for Canadarm to use. Defaults to empty. |
settings[handlers] |
Array
|
Array of Handlers for Canadarm to use. Defaults to empty. |
settings[logLevel] |
String
|
The log level to log at. Defaults to Canadarm.level.DEBUG. |
- Source:
Example
Canadarm.init({
onError: true, // Set to false if you do not want window.onerror set.
wrapEvents: true, // Set to false if you do not want all event handlers to be logged for errors
logLevel: Canadarm.level.WARN, // Will only send logs for level of WARN and above.
appenders: [
Canadarm.Appender.standardLogAppender
],
handlers: [
Canadarm.Handler.beaconLogHandler('http://example.com/beacon.gif'),
Canadarm.Handler.consoleLogHandler
]
})
-
<private> pushErrors(logAttributes, handlers)
-
Sends the errors passed in `logAttributes` for each logHandler.
Parameters:
| Name |
Type |
Description |
logAttributes |
object
|
- A key/value pairing of the attributes to log. |
handlers |
array
|
- If passed will override existing handlers and be used. |
- Source:
-
<private> setUpOnErrorHandler()
-
Sets up error handling at the window level.
- Source: