Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "bunyamin", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Bunyan-based logger for Node.js supporting Trace Event format", | ||
@@ -21,6 +21,72 @@ "license": "MIT", | ||
}, | ||
"files": ["docs", "!*.{jpg,svg,png}"], | ||
"engines": { | ||
"node": ">=14.18.2" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"typings": "./dist/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist", | ||
"!**/__mocks__", | ||
"!**/__tests__", | ||
"!**/__utils__", | ||
"!**/*.test.*" | ||
], | ||
"scripts": { | ||
"prepare": "husky install", | ||
"clean": "git clean -xdf", | ||
"build": "microbundle src/index.ts --target node --format cjs,es", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"lint:staged": "lint-staged", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.6.1", | ||
"@commitlint/config-conventional": "^17.6.1", | ||
"@types/bunyan": "^1.8.8", | ||
"@types/stream-json": "^1.7.3", | ||
"@typescript-eslint/eslint-plugin": "^5.29.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"bunyan": "^1.8.15", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.39.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-import-resolver-typescript": "^3.5.5", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jsdoc": "^43.1.1", | ||
"eslint-plugin-no-only-tests": "^3.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-unicorn": "^46.0.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.0.0", | ||
"lint-staged": "^13.2.2", | ||
"microbundle": "^0.15.1", | ||
"prettier": "^2.8.8", | ||
"semantic-release": "^21.0.2", | ||
"tempy": "^1.0.0", | ||
"ts-jest": "^29.1.0", | ||
"typedoc": "^0.24.6", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@flatten-js/interval-tree": "^1.0.20", | ||
"multi-sort-stream": "^1.0.4", | ||
"stream-json": "^1.7.5", | ||
"trace-event-lib": "^1.3.1" | ||
}, | ||
"peerDependencies": { | ||
"bunyan": "^1.8.15", | ||
"@types/bunyan": "^1.8.8" | ||
}, | ||
"peerDependenciesMeta": { | ||
"bunyan": { | ||
"optional": true | ||
}, | ||
"@types/bunyan": { | ||
"optional": true | ||
} | ||
} | ||
} |
@@ -35,11 +35,19 @@ <table align=center><tr><td rowspan=2 width="355px"> | ||
```js | ||
import { createLogger, traceEventStream } from 'bunyamin'; | ||
import { createLogger } from 'bunyan'; | ||
import { wrapLogger, traceEventStream } from 'bunyamin'; | ||
const logger = createLogger({ | ||
const bunyan = createLogger({ | ||
name: 'my-app', | ||
streams: [ | ||
traceEventStream({ outFile: '/path/to/trace.json', loglevel: 'trace' }), | ||
{ | ||
level: 'trace', | ||
stream: traceEventStream({ | ||
filePath: '/path/to/trace.json', | ||
loglevel: 'trace', | ||
}), | ||
} | ||
], | ||
}); | ||
const logger = wrapLogger({ logger: bunyan }); | ||
logger.info('Hello, world!'); | ||
@@ -108,9 +116,7 @@ ``` | ||
type LogEvent = { | ||
id?: string | number; | ||
cat?: string | string[]; | ||
cname?: string; | ||
pid?: never; | ||
tid?: never; | ||
ts?: never; | ||
ph?: never; | ||
pid?: number; | ||
tid?: number | string | [string, unknown]; | ||
[customProperty: string]: unknown; | ||
@@ -120,7 +126,8 @@ }; | ||
The `id` property can be used to assign an ID to the event, which can be helpful when logging concurrent or overlapping events. | ||
The `tid` property can be used to assign an explicit thread id to the event or a thread alias, | ||
which can be helpful when logging concurrent or overlapping events. | ||
### Child Loggers | ||
You can create a child logger with a specific context by calling the `child` method on the parent logger: | ||
Similar to Bunyan, you can create a child logger with a specific context by calling the `child` method on the parent logger: | ||
@@ -127,0 +134,0 @@ ```js |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
314121
128
3904
1
145
6
27
+ Addedmulti-sort-stream@^1.0.4
+ Addedstream-json@^1.7.5
+ Addedtrace-event-lib@^1.3.1
+ Added@flatten-js/interval-tree@1.1.3(transitive)
+ Added@types/bunyan@1.8.11(transitive)
+ Added@types/node@22.13.9(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbrowser-process-hrtime@1.0.0(transitive)
+ Addedbunyan@1.8.15(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddtrace-provider@0.8.8(transitive)
+ Addedglob@6.0.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addedmulti-sort-stream@1.0.4(transitive)
+ Addedmv@2.1.1(transitive)
+ Addednan@2.22.2(transitive)
+ Addedncp@2.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrimraf@2.4.5(transitive)
+ Addedsafe-json-stringify@1.2.0(transitive)
+ Addedstream-chain@2.2.5(transitive)
+ Addedstream-json@1.9.1(transitive)
+ Addedtrace-event-lib@1.4.1(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedwrappy@1.0.2(transitive)