1
1
import tracer from "dd-trace" ;
2
2
import express from 'express' ;
3
- import { BuffLog } from './bufflog' ;
3
+ import bufflog from './bufflog' ;
4
4
5
5
tracer . init ( {
6
6
hostname : "dd-agent-hostname" ,
7
7
logInjection : false
8
8
} ) ;
9
9
10
- let logger = new BuffLog ( ) ;
11
-
12
- logger . info ( 'hello info' ) ;
13
- logger . notice ( 'hello notice' ) ;
14
- logger . notice ( 'hello notice with context' , { "test" :"toto" } ) ;
15
- logger . warning ( 'hello warning' ) ;
16
- logger . error ( 'hello error' ) ;
17
- logger . critical ( 'hello critical' ) ;
18
- logger . critical ( 'hello critical' , { "some" :"stuff" } ) ;
10
+ bufflog . info ( 'hello info' ) ;
11
+ bufflog . notice ( 'hello notice' ) ;
12
+ bufflog . notice ( 'hello notice with context' , { "test" :"toto" } ) ;
13
+ bufflog . warning ( 'hello warning' ) ;
14
+ bufflog . error ( 'hello error' ) ;
15
+ bufflog . critical ( 'hello critical' ) ;
16
+ bufflog . critical ( 'hello critical' , { "some" :"stuff" } ) ;
19
17
20
18
const app = express ( ) ;
21
19
@@ -24,12 +22,11 @@ app.listen(4000, () => {
24
22
} ) ;
25
23
26
24
app . get ( '/' , ( req , res ) => {
27
- var logger = new BuffLog ( ) ;
28
- logger . notice ( "Notice log via endpoint" ) ;
29
- logger . info ( 'hello info' ) ;
30
- logger . debug ( 'hello debug' ) ;
31
- logger . notice ( 'hello notice' ) ;
32
- logger . warning ( 'hello warning' ) ;
33
- logger . error ( 'hello error' ) ;
34
- logger . critical ( 'hello critical' ) ;
25
+ bufflog . notice ( "Notice log via endpoint" ) ;
26
+ bufflog . info ( 'hello info' ) ;
27
+ bufflog . debug ( 'hello debug' ) ;
28
+ bufflog . notice ( 'hello notice' ) ;
29
+ bufflog . warning ( 'hello warning' ) ;
30
+ bufflog . error ( 'hello error' ) ;
31
+ bufflog . critical ( 'hello critical' ) ;
35
32
} ) ;
0 commit comments