Skip to content

Commit 857318b

Browse files
committed
chore(deps): Update dependencies and drop node < 10 support
1 parent 574ce54 commit 857318b

13 files changed

+1279
-1810
lines changed

.commitlintrc.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
rules:
2-
type-enum:
3-
- 2
4-
- always
5-
- ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"]
6-
subject-empty:
7-
- 2
8-
- never
9-
subject-max-length:
10-
- 2
11-
- always
12-
- 80
2+
type-enum:
3+
- 2
4+
- always
5+
- ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'chore', 'revert']
6+
subject-empty:
7+
- 2
8+
- never
9+
subject-max-length:
10+
- 2
11+
- always
12+
- 80

.eslintrc.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
parserOptions:
2-
ecmaVersion: 9
3-
sourceType: script
2+
ecmaVersion: 9
3+
sourceType: script
44
env:
5-
node: true
6-
es6: true
5+
node: true
6+
es6: true
77
extends: eslint:recommended
88
rules:
9-
no-unused-vars: off
9+
no-unused-vars: off

.travis.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
language: node_js
22
node_js:
3-
- '8'
4-
- '10'
5-
- '12'
6-
- '13'
3+
- '10'
4+
- '12'
5+
- '13'
76
script:
8-
- yarn run lint
9-
- yarn run check-fmt
10-
- yarn run tsc
11-
- yarn run test-cover
7+
- yarn run lint
8+
- yarn run check-fmt
9+
- yarn run tsc
10+
- yarn run test-cover
1211
after_success:
13-
- yarn run coverage
12+
- yarn run coverage
1413
notifications:
15-
slack:
16-
secure: vuBp7KKQqHax5B/9NS7D8GiedcpLPXrfe7gzsyDow89rcqv6O6dtePzF1QtujsCVExRYNhApgCSb+cA30aHaJih6sQ9F3/suPSa1ql1AbpNmpxuQFFGO2LiRIHQ5cFMiBpvr4vP/nK3emwdRukKNmVgVcikYUCmJhrEXaL2YvCWq2amZj8pe/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iZLY1ouL1WlTbcj84X9ou4idlCxBGScaaR/E4ddwEMH8C8C/QMRlpDQLyRJYH6PP1S7T8XCr7LHvLxaMn0C8TcRaXo0m8UdSy3kcWvAUCvgVXAngTZE1fzRELN4IaELwwfY=

README.md

+33-33
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77

88
A Lightweight logger that combines debug namespacing capabilities with winston levels and multioutput
99

10-
- [Installation](#installation)
11-
- [Usage](#usage)
12-
- [Using context ID](#using-context-id)
13-
- [Using namespaces](#using-namespaces)
14-
- [Outputs](#outputs)
15-
- [Metadata](#metadata)
16-
- [TypeScript](#typescript)
10+
- [Installation](#installation)
11+
- [Usage](#usage)
12+
- [Using context ID](#using-context-id)
13+
- [Using namespaces](#using-namespaces)
14+
- [Outputs](#outputs)
15+
- [Metadata](#metadata)
16+
- [TypeScript](#typescript)
1717

1818
## Installation
1919

2020
Using npm:
2121

22-
``` sh
22+
```sh
2323
npm install @ekino/logger
2424
```
2525

2626
Or yarn:
2727

28-
``` sh
28+
```sh
2929
yarn add @ekino/logger
3030
```
3131

@@ -40,12 +40,12 @@ A log instance is bounded to a namespace. To use it, instantiate a logger with a
4040

4141
This logger define 5 log levels: error, warn, info, debug, trace.
4242
When you set a level, all levels above it are enabled too.
43-
Log level can be set by calling `setLevel` function.
43+
Log level can be set by calling `setLevel` function.
4444

4545
For example, enabling `info` will enable `info`, `warn` and `error` but not `debug` or `trace`.
4646
The "special" log level `none` means no log and can only be used to set a namespace level.
4747

48-
``` js
48+
```js
4949
{ trace: 0, debug: 1, info: 2, warn: 3, error: 4 }
5050
```
5151

@@ -69,7 +69,7 @@ logger.debug('sample message', {
6969
})
7070
```
7171

72-
output:
72+
output:
7373

7474
![Example](docs/images/example_usage1.gif)
7575

@@ -79,15 +79,15 @@ One of the main complexity working with node is ability to follow all logs attac
7979
This is not mandatory, but based on our experience, we recommend as a best practice to add a unique identifier that will be passed all along functions calls.
8080
When you log something, you can provide this id as a first parameter and logger will log it. If not provided, it's auto generated.
8181

82-
The signature of the function with contextId is:
82+
The signature of the function with contextId is:
8383

8484
```js
8585
my_log.the_level(contextId, message, data)
8686
```
8787

8888
Example app.js
8989

90-
``` javascript
90+
```javascript
9191
const { setNamespaces, setLevel, createLogger } = require('@ekino/logger')
9292

9393
setNamespaces('root:*')
@@ -99,25 +99,25 @@ logger.debug('ctxId', 'log with predefined context ID', {
9999
})
100100
```
101101

102-
output:
102+
output:
103103

104104
![Example](docs/images/example_usage2.gif)
105105

106106
### Using namespaces
107107

108108
Logger relies on namespaces. When you want to log something, you should define a namespace that is bound to it.
109109
When you debug, this gives you the flexibility to enable only the namespaces you need to output.
110-
As a good practice, we recommend setting a namespace by folder / file.
110+
As a good practice, we recommend setting a namespace by folder / file.
111111
For example for a file in modules/login/dao you could define 'modules:login:dao'.
112112
Warning, "=" can't be part of the namespace as it's a reserved symbol.
113113

114114
You can also define a level per namespace. If no level is defined, the default global level is used.
115115
To disable logs of a namespace, you can specify a level `none`
116-
A namespace ':*' means eveything after ':' will be enabled. Namespaces are parsed as regexp.
116+
A namespace ':\*' means eveything after ':' will be enabled. Namespaces are parsed as regexp.
117117

118-
To define namespace level, you should suffix namespace with "=the_level"
119-
For example let's say you need to enable all info logs but for debug purpose you need to lower the level
120-
of the namespace database to `debug`. You could then use:
118+
To define namespace level, you should suffix namespace with "=the_level"
119+
For example let's say you need to enable all info logs but for debug purpose you need to lower the level
120+
of the namespace database to `debug`. You could then use:
121121

122122
```js
123123
const { setLevel, setNamespaces } = require('@ekino/logger')
@@ -173,11 +173,11 @@ setOutput(outputs.json)
173173
const logger = createLogger('namespace:subNamespace')
174174
logger.debug('ctxId', 'Will be logged', {
175175
someData: 'someValue',
176-
someData2: 'someValue'
176+
someData2: 'someValue',
177177
})
178178
```
179179

180-
output:
180+
output:
181181

182182
![Example](docs/images/example_usage3.gif)
183183

@@ -187,27 +187,27 @@ Pretty will output a yaml like content.
187187

188188
```js
189189
const { setNamespaces, setLevel, setOutput, outputs, createLogger } = require('@ekino/logger')
190-
190+
191191
setNamespaces('namespace:*')
192192
setLevel('debug')
193193
setOutput(outputs.pretty)
194194

195195
const logger = createLogger('namespace:subNamespace')
196196
logger.debug('ctxId', 'Will be logged', {
197197
someData: 'someValue',
198-
someData2: 'someValue'
198+
someData2: 'someValue',
199199
})
200200
```
201201

202-
output:
202+
output:
203203

204204
![Example](docs/images/example_pretty.gif)
205205

206206
#### Output function
207207

208208
An output, is a function that will receive log data and should transform and store it
209209

210-
Log data follow the format:
210+
Log data follow the format:
211211

212212
```
213213
{
@@ -223,22 +223,22 @@ Log data follow the format:
223223

224224
```js
225225
const { setNamespaces, setLevel, setOutput, outputs, outputUtils, createLogger } = require('@ekino/logger')
226-
226+
227227
setNamespaces('namespace:*')
228228
setLevel('debug')
229229

230230
const consoleAdapter = (log) => {
231231
console.log(outputUtils.stringify(log))
232232
}
233233

234-
// This will output in stdout with the pretty output
234+
// This will output in stdout with the pretty output
235235
// and in the same will log through native console.log() function (usually to stdout too)
236236
setOutput([outputs.pretty, consoleAdapter])
237237

238238
const logger = createLogger('namespace:subNamespace')
239239
logger.debug('ctxId', 'Will be logged', {
240240
someData: 'someValue',
241-
someData2: 'someValue'
241+
someData2: 'someValue',
242242
})
243243
```
244244

@@ -258,12 +258,12 @@ const consoleAdapter = (log) => {
258258
### Log data
259259

260260
Most of the time, a log message is not enough to guess context.
261-
You can append arbitrary data to your logs.
261+
You can append arbitrary data to your logs.
262262
If you're using some kind of log collector, you'll then be able to extract those values and inject them in elasticsearch for example.
263263

264264
```js
265265
const { setOutput, setNamespaces, setLevel, createLogger } = require('@ekino/logger')
266-
266+
267267
setOutput('pretty')
268268
setNamespaces('namespace:*')
269269
setLevel('info')
@@ -272,7 +272,7 @@ const logger = createLogger('namespace:subNamespace')
272272
logger.warn('message', { someData: 'someValue' })
273273
```
274274

275-
output:
275+
output:
276276

277277
![Example](docs/images/example_data.gif)
278278

@@ -293,7 +293,7 @@ const logger = createLogger('namespace')
293293
logger.warn('message', { someData: 'someValue' })
294294
```
295295

296-
output:
296+
output:
297297

298298
![Example](docs/images/example_context.gif)
299299

0 commit comments

Comments
 (0)