Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elmahio/elmah.io.javascript
elmah.io javascript logger.
https://github.com/elmahio/elmah.io.javascript
crash-reporting crash-reporting-tool elmah elmah-io error-handling error-log error-monitoring error-reporting javascript javascript-logger logger logging
Last synced: about 2 months ago
JSON representation
elmah.io javascript logger.
- Host: GitHub
- URL: https://github.com/elmahio/elmah.io.javascript
- Owner: elmahio
- License: apache-2.0
- Created: 2018-08-23T07:10:28.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-08-03T08:30:45.000Z (5 months ago)
- Last Synced: 2024-11-08T20:25:11.491Z (about 2 months ago)
- Topics: crash-reporting, crash-reporting-tool, elmah, elmah-io, error-handling, error-log, error-monitoring, error-reporting, javascript, javascript-logger, logger, logging
- Language: JavaScript
- Homepage: https://elmah.io
- Size: 4.9 MB
- Stars: 0
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# elmah.io.javascript
![license](https://img.shields.io/hexpm/l/plug.svg?style=flat-square)Log to [elmah.io](https://elmah.io) from JavaScript. For the most recent documentation, visit [Logging to elmah.io from JavaScript](https://docs.elmah.io/logging-to-elmah-io-from-javascript/).
### Initialization
Immediately-Invoked Function Expression (IIFE)
```html```
UMD Constructor with options
```htmlvar log = new Elmahio({
apiKey: 'YOUR-API-KEY',
logId: 'YOUR-LOG-ID',
});```
### Default options
```javascript
new Elmahio({
apiKey: null,
logId: null,
debug: false,
application: null,
filter: null,
captureConsoleMinimumLevel: 'none',
breadcrumbs: false,
breadcrumbsNumber: 10
});
```### Manual logging
*Works only with UMD Constructor !*
```javascript
var log = new Elmahio({
apiKey: 'YOUR-API-KEY',
logId: 'YOUR-LOG-ID',
});log.verbose(msg);
log.verbose(msg, error);log.debug(msg);
log.debug(msg, error);log.information(msg);
log.information(msg, error);log.warning(msg);
log.warning(msg, error);log.error(msg);
log.error(msg, error);log.fatal(msg);
log.fatal(msg, error);
```
Where __msg__ is a text string and __error__ is a [JavaScript Error Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error).### Manual logging using console logging
*Works only with UMD Constructor !
console.log() is not available for logging !*
```javascript
var log = new Elmahio({
apiKey: 'YOUR-API-KEY',
logId: 'YOUR-LOG-ID',
captureConsoleMinimumLevel: 'debug' // options available: 'none', 'debug', 'info', 'warn', 'error'
});// captureConsoleMinimumLevel: 'none' will disable logging from console;
// captureConsoleMinimumLevel: 'debug' will enable all of them - console.debug, console.info, console.warn, console.error;
// captureConsoleMinimumLevel: 'info' will enable - console.info, console.warn, console.error;
// captureConsoleMinimumLevel: 'warn' will enable - console.warn, console.error;
// captureConsoleMinimumLevel: 'error' will enable - console.error.console.error('This is an %s message.', 'error');
console.warn('This is a %s message.', 'warning');
console.info('This is an %s message.', 'information');
console.debug('This is a %s message.', 'debug');
```### Acknowledgments
* [Rojan Gharibpour](https://github.com/Sojaner)