{"id":26679926,"url":"https://github.com/xseman/log4js-layout-json","last_synced_at":"2025-04-12T11:33:24.074Z","repository":{"id":239356766,"uuid":"671571707","full_name":"xseman/log4js-layout-json","owner":"xseman","description":"Log4js JSON layout","archived":false,"fork":false,"pushed_at":"2024-12-22T20:26:11.000Z","size":89,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T06:18:51.871Z","etag":null,"topics":["json","log4js","log4js-layout","log4js-node","logger"],"latest_commit_sha":null,"homepage":"http://npm.im/log4js-layout-json","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xseman.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":"2023-07-27T16:12:52.000Z","updated_at":"2024-12-22T20:26:05.000Z","dependencies_parsed_at":"2024-05-17T06:24:04.874Z","dependency_job_id":null,"html_url":"https://github.com/xseman/log4js-layout-json","commit_stats":null,"previous_names":["xseman/log4js-layout-json","arch-group/log4js-layout-json"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xseman%2Flog4js-layout-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xseman%2Flog4js-layout-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xseman%2Flog4js-layout-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xseman%2Flog4js-layout-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xseman","download_url":"https://codeload.github.com/xseman/log4js-layout-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248560233,"owners_count":21124614,"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":["json","log4js","log4js-layout","log4js-node","logger"],"created_at":"2025-03-26T06:18:57.157Z","updated_at":"2025-04-12T11:33:24.052Z","avatar_url":"https://github.com/xseman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log4js layout - json\n\nSimple json layout module for [log4js][log4js_github].\n\n[log4js_github]: https://log4js-node.github.io/log4js-node/\n\n## Installation\n\n### npm registry\n\n```sh\nnpm install log4js-layout-json\n```\n\n## Example Output\n\nOutput:\n\n```plain\n{\"time\":\"2024-05-11T18:18:34.266Z\",\"category\":\"default\",\"level\":\"INFO\",\"msg\":\"Initializing DB connection\"}\n```\n\nAdding context:\n\n```ts\nlog.addContext(\"user\", \"john\");\n```\n\n```plain\n{\"time\":\"2024-05-11T18:19:34.266Z\",\"category\":\"default\",\"level\":\"INFO\",\"msg\":\"Initializing DB connection\",\"user\":\"john\"}\n```\n\n## Usage\n\nSet the layout type to `json`.\n\nEach log object contains the following properties:\n\n- `time` - time in ISO 8601 format\n- `category` - specified when log4js is initialized\n- `msg` - if the log message is a string, otherwise omitted\n- `level` - level in human readable format\n\n## Example configuration\n\n```ts\nimport log4js from \"log4js\";\nimport { layout as jsonLayout } from \"log4js-json-layout\";\n\nlog4js.addLayout(\"json\", jsonLayout);\n```\n\nminimal:\n\n```ts\nlog4js.configure({\n\tappenders: {\n\t\tout: {\n\t\t\ttype: \"stdout\",\n\t\t\tlayout: {\n\t\t\t\ttype: \"json\",\n\t\t\t\tincludeFileName: true,\n\t\t\t\tincludeFunctionName: true,\n\t\t\t},\n\t\t},\n\t},\n\tcategories: {\n\t\tdefault: {\n\t\t\tlevel: \"debug\",\n\t\t\tappenders: [\"out\"],\n\t\t},\n\t},\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxseman%2Flog4js-layout-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxseman%2Flog4js-layout-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxseman%2Flog4js-layout-json/lists"}