Skip to content

Commit 75f7c5a

Browse files
Use named export
1 parent 4fcc4d7 commit 75f7c5a

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ logger for all javascript and typescript Buffer services
88
```js
99

1010
// CommonJS style
11-
const bufflog = require('@bufferapp/bufflog');
11+
const Bufflog = require('@bufferapp/bufflog');
1212

1313
// ES6 style
14-
import * as bufflog from "@bufferapp/bufflog";
14+
import Bufflog from "@bufferapp/bufflog";
1515

16-
bufflog.debug('hello critical', {"some":"stuff"});
17-
bufflog.info('hello info');
18-
bufflog.notice('hello notice with context', {"foo":"bar"});
19-
bufflog.error('hello error');
20-
bufflog.critical('hello critical');
16+
Bufflog.debug('hello critical', {"some":"stuff"});
17+
Bufflog.info('hello info');
18+
Bufflog.notice('hello notice with context', {"foo":"bar"});
19+
Bufflog.error('hello error');
20+
Bufflog.critical('hello critical');
2121
```
2222

2323
## Log verbosity levels
@@ -57,5 +57,5 @@ tracer.init({
5757
## Use bufflog middleware with express
5858
```js
5959
const app = express();
60-
app.use(bufflog.middleware())
60+
app.use(Bufflog.middleware())
6161
```

bufflog.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const pinoLogger = require('pino')({
1616
fatal: 500
1717
},
1818
// necessary if we want to override the level "number"
19-
useOnlyCustomLevels: true,
19+
useOnlyCustomLevels: true,
2020

2121
});
2222

@@ -65,3 +65,16 @@ export function middleware() {
6565
},
6666
})
6767
}
68+
69+
const BuffLog = {
70+
getLogger,
71+
debug,
72+
info,
73+
notice,
74+
warning,
75+
error,
76+
critical,
77+
middleware,
78+
}
79+
80+
export default BuffLog

index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import tracer from "dd-trace";
22
import express from 'express';
33

44
// CommonJS style
5-
//const BuffLog = require('./bufflog');
5+
// const BuffLog = require('./bufflog');
66

77
// ES6 style
8-
import * as BuffLog from "./bufflog";
8+
import BuffLog from "./bufflog";
99

1010
tracer.init({
1111
hostname: "dd-agent-hostname",

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)