Skip to content

Commit 354254a

Browse files
authored
Merge pull request #23 from elmahio/beta
Logging to elmah.io from console
2 parents 3996aac + ba7d39d commit 354254a

File tree

9 files changed

+3286
-2598
lines changed

9 files changed

+3286
-2598
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ new Elmahio({
2929
logId: null,
3030
debug: false,
3131
application: null,
32-
filter: null
32+
filter: null,
33+
captureConsoleMinimumLevel: 'none'
3334
});
3435
```
3536

@@ -61,6 +62,29 @@ log.fatal(msg, error);
6162
```
6263
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).
6364

65+
### Manual logging using console logging
66+
*Works only with UMD Constructor !
67+
console.log() is not available for logging !*
68+
```javascript
69+
var log = new Elmahio({
70+
apiKey: 'YOUR-API-KEY',
71+
logId: 'YOUR-LOG-ID',
72+
captureConsoleMinimumLevel: 'debug' // options available: 'none', 'debug', 'info', 'warn', 'error'
73+
});
74+
75+
// captureConsoleMinimumLevel: 'none' will disable logging from console;
76+
// captureConsoleMinimumLevel: 'debug' will enable all of them - console.debug, console.info, console.warn, console.error;
77+
// captureConsoleMinimumLevel: 'info' will enable - console.info, console.warn, console.error;
78+
// captureConsoleMinimumLevel: 'warn' will enable - console.warn, console.error;
79+
// captureConsoleMinimumLevel: 'error' will enable - console.error.
80+
81+
console.error('This is an %s message.', 'error');
82+
console.warn('This is a %s message.', 'warning');
83+
console.info('This is an %s message.', 'information');
84+
console.debug('This is a %s message.', 'debug');
85+
```
86+
87+
6488
### Acknowledgments
6589

66-
* [Rojan Gharibpour](https://github.com/Sojaner)
90+
* [Rojan Gharibpour](https://github.com/Sojaner)

0 commit comments

Comments
 (0)