-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathexample.js
31 lines (26 loc) · 1006 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var lawgs = require('./index');
// Lawgs configuration is mandatory
lawgs.config({
aws: {
accessKeyId: '********', /* Optional is credentials are set in ~/.aws/credentials */
secretAccessKey: '******', /* Optional */
region: 'us-east-1' /* Required */
}
});
var logger = lawgs.getOrCreate('SuperbowlLogs'); /* LogGroup */
var logger2 = lawgs.getOrCreate('SuperbowlLogs'); /* Returns the same instance (caching factory) */
// Logger configuration is optional
logger.config({
// Shows the debugging messages
showDebugLogs: true, /* Default to false */
// Change the frequency of log upload, regardless of the batch size
uploadMaxTimer: 1000, /* Defaults to 5000ms */
// Max batch size. An upload will be triggered if this limit is reached within the max upload time
uploadBatchSize: 10 /* Defaults to 500 */
});
/* 'error' is the log stream name */
logger.log('error', 'Argggg'); // Takes a string
logger.log('touchdown', { // or any serializable object
team: 'Patriots',
weight: 7
});