Comparing version
{ | ||
"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
4621.49%128
4166.67%3904
Infinity%1
-50%145
5.07%6
Infinity%27
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added