{"id":24228763,"url":"https://github.com/blacha/pretty-json-log","last_synced_at":"2025-07-16T22:37:21.886Z","repository":{"id":35780598,"uuid":"219233469","full_name":"blacha/pretty-json-log","owner":"blacha","description":"Pretty print json log files","archived":false,"fork":false,"pushed_at":"2024-01-03T05:09:02.000Z","size":603,"stargazers_count":6,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T05:48:32.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blacha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-03T00:52:56.000Z","updated_at":"2023-11-22T07:14:43.000Z","dependencies_parsed_at":"2024-01-02T00:01:40.208Z","dependency_job_id":"1c590876-da57-4d47-963b-209523c64755","html_url":"https://github.com/blacha/pretty-json-log","commit_stats":{"total_commits":178,"total_committers":6,"mean_commits":"29.666666666666668","dds":0.6292134831460674,"last_synced_commit":"17a2edbf0b42d31cf05c412d090f477d57f2d1d4"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/blacha/pretty-json-log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fpretty-json-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fpretty-json-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fpretty-json-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fpretty-json-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blacha","download_url":"https://codeload.github.com/blacha/pretty-json-log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fpretty-json-log/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265546451,"owners_count":23785972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-14T11:32:39.355Z","updated_at":"2025-07-16T22:37:21.847Z","avatar_url":"https://github.com/blacha.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pretty Json Log (PJL)\n\nConvert JSON log lines into simple pretty colored log output\n\nConverts\n\n```json\n{\"pid\":0,\"time\":\"2019-11-03T00:48:55.623Z\",\"hostname\":\"\",\"level\":30,\"msg\":\"HTTPGet\",\"v\":0,\"name\":\"cogview\",\"firstChunk\":0,\"lastChunk\":0,\"chunkCount\":1,\"bytes\":32768,\"fetchRange\":\"bytes=0-32768\"}\n{\"pid\":0,\"time\":\"2019-11-03T00:48:55.677Z\",\"hostname\":\"\",\"level\":30,\"msg\":\"HTTPGet\",\"v\":0,\"name\":\"cogview\",\"firstChunk\":94,\"lastChunk\":95,\"chunkCount\":1,\"bytes\":32768,\"fetchRange\":\"bytes=3080192-3145728\"}\n```\n\ninto\n\n![Example output](./static/pretty-output.png)\n\n![Example output OpenTelemetry](./static/pretty-output-ot.png)\n\n## Install\n\n```bash\nnpm i -g pretty-json-log\n\ncat \u003clog-file\u003e | pjl \n```\n\nLogs can be filtered using `--level`\n\n```\ncat \u003clog-file\u003e | pjl --level 20\n```\n\n### OpenTelemetry Log options\n\nDo not output `Resources` \n\n```\ncat \u003clog-file\u003e | pjl --ignore-resources\n```\n\n## Basic log type\n\nTo be pretty printable the basic json line needs to have:\n\nEither:\n\n1. A PinoJS log message\n\n```typescript\n/** Base log object every log object should have at minimum these three keys */\nexport interface LogMessage extends Record\u003cstring, any\u003e {\n    /** Log level */\n    level: number;\n    /** Time stamp either a ISO8601 string, timestamp number in ms or a Date */\n    time: number | string | Date;\n    /** Log message */\n    msg: string;\n}\n```\n\n2. A [OpenTelemetry](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md) Log Message\n\n```typescript\nexport interface LogMessageOpenTelemetry {\n    /** Timestamp in nanoseconds if a string, or ms if a number */\n    Timestamp: number | string\n    /** Message body */\n    Body?: unknown;\n    Resource?: Record\u003cstring, unknown\u003e;\n    Attributes?: Record\u003cstring, unknown\u003e;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fpretty-json-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacha%2Fpretty-json-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fpretty-json-log/lists"}