json-log-line 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Spencer Snyder <spencer@spencersnyder.io>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # JSON Log Line Utility
2
+
3
+ This utility is designed to take JSON and plain objects and convert them into log line strings. It's compatible with any nd JSON logger.
4
+
5
+ ## Features
6
+
7
+ - **JSON and Plain Object Support**: This utility can handle both JSON and plain objects, providing flexibility in the types of data you can convert into log line strings.
8
+
9
+ - **Compatible with any nd JSON Logger**: This utility is designed to work with any nd JSON logger, making it a versatile tool for your logging needs.
10
+
11
+ ## Installation
12
+
13
+ To install this utility, use the following command:
14
+
15
+ `npm install json-log-line`
16
+
17
+ ## Usage
18
+
19
+ To use this utility, simply pass your JSON or plain object to the `logLineFactory` function:
20
+
21
+ ```typescript
22
+ const options = {
23
+ /**
24
+ * The key to use for the error object. Defaults to `err`.
25
+ */
26
+ errorKey: "err",
27
+ /**
28
+ * include and exclude both take keys with dot notation
29
+ */
30
+ exclude: [],
31
+ /**
32
+ * include always overrides exclude
33
+ */
34
+ include: [],
35
+ /**
36
+ * Format functions for any given key, keys of the object are automatically included and cannot be excluded
37
+ * You can use dot notation as the object keys. The keys will print in order.
38
+ */
39
+ format: {
40
+ some: (obj: any) => {
41
+ return obj["some-key"].toString();
42
+ },
43
+ part: (obj: any) => {
44
+ return obj["some-key"].toString();
45
+ },
46
+ of: (obj: any) => {
47
+ return obj["some-key"].toString();
48
+ },
49
+ log: (obj: any) => {
50
+ return obj["some-key"].toString();
51
+ },
52
+ },
53
+ };
54
+
55
+ export const lineFormatter = logLineFactory(yourObject);
56
+ ```
57
+
58
+ This will return a formatter that can process strings or object output from any nd JSON logger.
59
+
60
+ example:
61
+
62
+ ```javascript
63
+ import { logLineFactory } from "json-log-line";
64
+
65
+ const options = {
66
+ include: ["nested.field"],
67
+ exclude: ["nested"],
68
+ format: {
69
+ part1: (value) => `[${value}]`,
70
+ part2: (value) => `[${value}]`,
71
+ "nested.field": (value) => `:${value}:\n`,
72
+ },
73
+ };
74
+
75
+ const lineFormatter = logLineFactory(options);
76
+
77
+ const log = JSON.stringify({
78
+ nested: {
79
+ other: "something",
80
+ field: "FIELD",
81
+ },
82
+ part1: "hello",
83
+ part2: "world",
84
+ some: "extra",
85
+ data: "here",
86
+ });
87
+
88
+ console.log(lineFormatter(log));
89
+ // =>
90
+ // [hello] [world] :FIELD:
91
+ // {"some":"extra","data":"here"}
92
+ ```
93
+
94
+ Often times you will want to stream nd json logs into a function that formats each log.
95
+
96
+ ## Options
97
+
98
+ ### format
99
+
100
+ `Record<keyof parsed log object, () => string>`
101
+
102
+ Format is an object the represents how you want to parse the log object. It will parse in natural order of the object.
103
+
104
+ #### format.extraFields
105
+
106
+ A special key that contains the rest of the log object fields which were both included and not formatted by a format function.
107
+
108
+ ### include
109
+
110
+ `string[]`
111
+
112
+ An array of object keys to include. Overrides excludes. All keys are included by default.
113
+
114
+ ### exclude
115
+
116
+ `string[]`
117
+
118
+ An array of object keys to exclude. The keys can be nested. Can be overridden with a more deeply nested include.
@@ -0,0 +1,19 @@
1
+ export type Options = {
2
+ exclude?: string | string[];
3
+ include?: string | string[];
4
+ format?: Record<string, (value: any, parsedLogObject?: any, ...arguments_: any[]) => string>;
5
+ logLineKeys?: string | string[];
6
+ };
7
+ export declare function logLineFactory({
8
+ /**
9
+ * include and exclude both take keys with dot notation
10
+ */
11
+ exclude,
12
+ /**
13
+ * include always overrides exclude
14
+ */
15
+ include,
16
+ /**
17
+ * Format functions for any given key, keys of the object are automatically included and cannot be excluded
18
+ */
19
+ format, }?: Options): (inputData: string | Record<string, unknown>) => string;
@@ -0,0 +1,102 @@
1
+ import jsonParse from 'fast-json-parse';
2
+ import unset from 'unset-value';
3
+ import get from 'get-value';
4
+ import set from 'set-value';
5
+ import isObject from './utils/is-object.js';
6
+ import isEmpty from './utils/is-empty.js';
7
+ const nl = '\n';
8
+ export function logLineFactory({
9
+ /**
10
+ * include and exclude both take keys with dot notation
11
+ */
12
+ exclude = [],
13
+ /**
14
+ * include always overrides exclude
15
+ */
16
+ include = [],
17
+ /**
18
+ * Format functions for any given key, keys of the object are automatically included and cannot be excluded
19
+ */
20
+ format = {}, } = {}) {
21
+ const logLineKeys = Object.keys(format);
22
+ format.extraFields ||= (object) => JSON.stringify(object) + nl;
23
+ /**
24
+ * @param inputData - The input data to be formatted can be a JSON stringified object or a plain object
25
+ */
26
+ return function (inputData) {
27
+ try {
28
+ let object = {};
29
+ if (typeof inputData === 'string') {
30
+ const parsedData = jsonParse(inputData);
31
+ if (!parsedData.value || parsedData.err) {
32
+ return inputData + nl;
33
+ }
34
+ object = parsedData.value;
35
+ }
36
+ else if (isObject(inputData)) {
37
+ object = inputData;
38
+ }
39
+ else {
40
+ return nl;
41
+ }
42
+ // cache the whitelist
43
+ const whiteListObject = {};
44
+ for (const key of [...logLineKeys, ...include]) {
45
+ const value = get(object, key);
46
+ if (value) {
47
+ set(whiteListObject, key, value);
48
+ }
49
+ }
50
+ // remove the blacklist
51
+ for (const key of exclude) {
52
+ unset(object, key);
53
+ }
54
+ // add back in the whitelist
55
+ object = {
56
+ ...object,
57
+ ...whiteListObject,
58
+ };
59
+ const output = [];
60
+ for (const key of logLineKeys) {
61
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
62
+ const value = get(object, key);
63
+ if (!value) {
64
+ continue;
65
+ }
66
+ const formatter = format[key];
67
+ if (formatter) {
68
+ output.push(formatter(value, object));
69
+ }
70
+ }
71
+ // remove the properties that were used to create the log-line
72
+ for (const key of logLineKeys) {
73
+ unset(object, key);
74
+ }
75
+ // remove empty blacklist that may have had whitelisted properties
76
+ for (const key of exclude) {
77
+ if (isEmpty(get(object, key))) {
78
+ unset(object, key);
79
+ }
80
+ }
81
+ let outputString = output.filter(Boolean).join(' ');
82
+ // after processing the rest of the object contains
83
+ // extra fields that were not in the logLine nor in the log line nor blacklisted
84
+ // so these are the ones we want to prettify and highlight
85
+ if (isObject(object) && !isEmpty(object) && format.extraFields) {
86
+ outputString = outputString.concat(format.extraFields(object));
87
+ }
88
+ if (!outputString.endsWith(nl)) {
89
+ outputString += nl;
90
+ }
91
+ if (outputString === nl) {
92
+ return JSON.stringify(object) + nl;
93
+ }
94
+ return outputString;
95
+ }
96
+ catch (error) {
97
+ console.log(error);
98
+ return '';
99
+ }
100
+ };
101
+ }
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,GAAG,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AC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBAC/D,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACjE,CAAC;YAED,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC/B,YAAY,IAAI,EAAE,CAAC;YACrB,CAAC;YAED,IAAI,YAAY,KAAK,EAAE,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YACrC,CAAC;YAED,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function isEmpty(object: unknown): object is Record<string, never>;
2
+ export default isEmpty;
@@ -0,0 +1,9 @@
1
+ import isObject from './is-object.js';
2
+ function isEmpty(object) {
3
+ return Boolean(isObject(object) &&
4
+ (object === undefined ||
5
+ object === null ||
6
+ Object.keys(object).length === 0));
7
+ }
8
+ export default isEmpty;
9
+ //# sourceMappingURL=is-empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty.js","sourceRoot":"","sources":["../../../src/utils/is-empty.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,OAAO,CAAC,MAAe;IAC9B,OAAO,OAAO,CACZ,QAAQ,CAAC,MAAM,CAAC;QACd,CAAC,MAAM,KAAK,SAAS;YACnB,MAAM,KAAK,IAAI;YACf,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CACtC,CAAC;AACJ,CAAC;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function isObject(input: unknown): input is object;
2
+ export default isObject;
@@ -0,0 +1,6 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-types
2
+ function isObject(input) {
3
+ return Boolean(input && Object.prototype.toString.apply(input) === '[object Object]');
4
+ }
5
+ export default isObject;
6
+ //# sourceMappingURL=is-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-object.js","sourceRoot":"","sources":["../../../src/utils/is-object.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CACZ,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,iBAAiB,CACtE,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import test from 'ava';
2
+ import { logLineFactory } from '../src/index.js';
3
+ test('named export is a function', (t) => {
4
+ t.is(typeof logLineFactory, 'function');
5
+ });
6
+ test('returns the original JSON stringified string if no formatters are provided', (t) => {
7
+ const logLine = logLineFactory();
8
+ const input = JSON.stringify({ foo: 'bar' });
9
+ const result = logLine(input);
10
+ t.is(result, input + '\n');
11
+ });
12
+ test('returns the JSON stringified object if an object is the input', (t) => {
13
+ const logLine = logLineFactory();
14
+ const input = { foo: 'bar' };
15
+ const stringified = JSON.stringify(input);
16
+ t.is(logLine(input), stringified + '\n');
17
+ });
18
+ test('creates a simple log line', (t) => {
19
+ const input = JSON.stringify({ foo: 'bar' });
20
+ const format = {
21
+ foo: (value) => value,
22
+ };
23
+ const logLine = logLineFactory({ format });
24
+ t.is(logLine(input), 'bar\n');
25
+ });
26
+ test('creates a simple log line with default extra fields', (t) => {
27
+ const input = JSON.stringify({ foo: 'bar', extra: 'baz' });
28
+ const format = {
29
+ foo: (value) => value + '\n',
30
+ };
31
+ const logLine = logLineFactory({ format });
32
+ t.is(logLine(input), 'bar\n{"extra":"baz"}\n');
33
+ });
34
+ test('creates a simple log line with formatted extra fields', (t) => {
35
+ const input = JSON.stringify({ foo: 'bar', extra: 'baz' });
36
+ const format = {
37
+ foo: (value) => value + '\n',
38
+ extraFields: (value) => JSON.stringify(value, null, 2),
39
+ };
40
+ const logLine = logLineFactory({ format });
41
+ t.is(logLine(input), 'bar\n' + JSON.stringify({ extra: 'baz' }, null, 2) + '\n');
42
+ });
43
+ test('nested fields can be added to log line and removed from extra fields', (t) => {
44
+ const input = JSON.stringify({ foo: { bar: 'baz' } });
45
+ const format = {
46
+ 'foo.bar': (value) => value + '\n',
47
+ };
48
+ const logLine = logLineFactory({ format });
49
+ t.is(logLine(input), 'baz\n{"foo":{}}\n');
50
+ });
51
+ test('nested respect exlude and include', (t) => {
52
+ const input = JSON.stringify({ foo: { bar: 'baz', biz: 'buz', no: 'output' } });
53
+ const format = {
54
+ 'foo.bar': (value) => value + '\n',
55
+ };
56
+ const logLine = logLineFactory({
57
+ format,
58
+ exclude: ['foo'],
59
+ include: ['foo.biz'],
60
+ });
61
+ t.is(logLine(input), 'baz\n{"foo":{"biz":"buz"}}\n');
62
+ });
63
+ //# sourceMappingURL=create-log-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-log-line.js","sourceRoot":"","sources":["../../test/create-log-line.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC,EAAE,EAAE;IACvC,CAAC,CAAC,EAAE,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4EAA4E,EAAE,CAAC,CAAC,EAAE,EAAE;IACvF,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,KA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,IAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG;QACb,SAAS,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;KAC3C,CAAC;IACF,MAAM,OAAO,GAAG,cAAc,CAAC;QAC7B,MAAM;QACN,OAAO,EAAE,CAAC,KAAK,CAAC;QAChB,OAAO,EAAE,CAAC,SAAS,CAAC;KACrB,CAAC,CAAC;IACH,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,8BAA8B,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "json-log-line",
3
+ "version": "0.0.1",
4
+ "description": "A utility for building awesome log lines from JSON",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Spencer Snyder",
8
+ "email": "sasnyde2@gmail.com",
9
+ "url": "https://spencersnyder.io"
10
+ },
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/src/index.d.ts",
16
+ "default": "./dist/src/index.js"
17
+ }
18
+ }
19
+ },
20
+ "main": "dist/src/index.js",
21
+ "source": "./src/app/client/main.ts",
22
+ "types": "dist/src/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "npm run clean && tsc --project tsconfig.build.json",
28
+ "build:test": "npm run clean && tsc --project tsconfig.json",
29
+ "build:watch": "npm run clean && tsc --project tsconfig.json --watch",
30
+ "check": "tsc --project ./tsconfig.json",
31
+ "clean": "rimraf dist",
32
+ "dev": "NODE_NO_WARNINGS=1 node --loader ts-node/esm/transpile-only ./src/index.ts",
33
+ "dev:watch": "NODE_NO_WARNINGS=1 node --watch --loader ts-node/esm/transpile-only ./src/index.ts",
34
+ "lint": "xo",
35
+ "lint:fix": "xo --fix",
36
+ "prepare": "husky",
37
+ "release": "np",
38
+ "test": "npm run build:test && c8 ava",
39
+ "test:watch": "ava --watch",
40
+ "update": "ncu -i"
41
+ },
42
+ "prettier": {
43
+ "plugins": [
44
+ "prettier-plugin-packagejson"
45
+ ]
46
+ },
47
+ "ava": {
48
+ "files": [
49
+ "dist/test/**",
50
+ "!dist/test/fixtures/**",
51
+ "!dist/test/helpers/**"
52
+ ],
53
+ "nodeArguments": [
54
+ "--no-warnings"
55
+ ],
56
+ "verbose": true
57
+ },
58
+ "dependencies": {
59
+ "fast-json-parse": "^1.0.3",
60
+ "get-value": "^3.0.1",
61
+ "set-value": "^4.1.0",
62
+ "unset-value": "^2.0.1"
63
+ },
64
+ "devDependencies": {
65
+ "@commitlint/cli": "^19.4.1",
66
+ "@commitlint/config-conventional": "^19.4.1",
67
+ "@types/get-value": "^3.0.5",
68
+ "@types/node": "^22.5.4",
69
+ "@types/set-value": "^4.0.3",
70
+ "ava": "^6.1.3",
71
+ "c8": "^10.1.2",
72
+ "husky": "^9.1.5",
73
+ "lint-staged": "^15.2.10",
74
+ "np": "^10.0.7",
75
+ "npm-check-updates": "latest",
76
+ "npm-package-json-lint": "^8.0.0",
77
+ "npm-package-json-lint-config-default": "^7.0.1",
78
+ "prettier": "^3.3.3",
79
+ "prettier-plugin-packagejson": "^2.5.2",
80
+ "rimraf": "^6.0.1",
81
+ "ts-node": "^10.9.2",
82
+ "xo": "^0.59.3"
83
+ }
84
+ }