{"id":20986818,"url":"https://github.com/karmaniverous/edge-logger","last_synced_at":"2026-01-27T13:31:04.641Z","repository":{"id":65807859,"uuid":"600346214","full_name":"karmaniverous/edge-logger","owner":"karmaniverous","description":"A simple logging class that renders nicely-formatted logs and plays nicely with edge networks.","archived":false,"fork":false,"pushed_at":"2024-08-12T05:54:50.000Z","size":2690,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-14T05:12:13.999Z","etag":null,"topics":["edge-network","logging","nextjs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@karmaniverous/edge-logger","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karmaniverous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["karmaniverous"]}},"created_at":"2023-02-11T07:43:23.000Z","updated_at":"2024-09-19T05:45:29.000Z","dependencies_parsed_at":"2023-07-07T10:33:22.058Z","dependency_job_id":"4b56d2b6-482f-4602-9753-0d57354af043","html_url":"https://github.com/karmaniverous/edge-logger","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"694373365f37f9d6aded7a1949ad61c35bee377f"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmaniverous%2Fedge-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmaniverous%2Fedge-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmaniverous%2Fedge-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmaniverous%2Fedge-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karmaniverous","download_url":"https://codeload.github.com/karmaniverous/edge-logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224996515,"owners_count":17404487,"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":["edge-network","logging","nextjs"],"created_at":"2024-11-19T06:14:59.776Z","updated_at":"2026-01-27T13:30:59.610Z","avatar_url":"https://github.com/karmaniverous.png","language":"JavaScript","funding_links":["https://github.com/sponsors/karmaniverous"],"categories":[],"sub_categories":[],"readme":"# edge-logger\n\nThe [Next.js Edge Runtime](https://nextjs.org/docs/api-reference/edge-runtime) is extremely limited as to the packages it can load.\n\nThis can pose a challenge for common logging and utility packages like [`winston`](https://www.npmjs.com/package/winston) and [`lodash`](https://www.npmjs.com/package/lodash), which will fail when loaded into an edge resource.\n\nLogging is a cross-cutting concern, and shouldn't have to care where it is executed. So this package is a simple, flexible logging utility that...\n\n- formats logs attractively, whether output to the console or cloud services like AWS CloudWatch.\n- features configurable logging levels (defaults to [SysLog](https://en.wikipedia.org/wiki/Syslog#Severity_level)).\n- can handle virtually any input, including circular object references.\n- can truncate long strings for readability.\n\n## Installation\n\n```bash\nnpm install @karmaniverous/edge-logger\n```\n\n## Usage\n\n```js\nimport Logger from `@karmaniverous/edge-logger`;\nconst logger = new Logger();\n\nlogger.emerg('emergency message', { foo: 'bar' }); // rendered with console.error()\nlogger.alert('alert message');                     // rendered with console.error()\nlogger.crit('critical message');                   // rendered with console.error()\nlogger.error('error message');                     // rendered with console.error()\nlogger.warning('warning message');                 // rendered with console.warn()\nlogger.notice('notice message');                   // rendered with console.info()\nlogger.info('info message');                       // rendered with console.info()\nlogger.debug('debug message');                     // rendered with console.debug()\nlogger.log('log message');                     // rendered with console.info()\n\n// emerg:   emergency message\n// emerg:   {\n// emerg:     \"foo\": \"bar\"\n// emerg:   }\n// alert:   alert message\n// crit:    critical message\n// error:   error message\n// warning: warning message\n// notice:  notice message\n// info:    info message\n// info:    log message\n\n// debug level not rendered by default.\n// Set LOG_LEVEL to 'debug' to see these.\n```\n\n## Configuration\n\nSet your minimum logging level with environment variable `LOG_LEVEL` (by default it is `info`).\n\nThe optional constructor `config` argument has the following keys:\n\n| Key            | Description                                                                                                              |\n| -------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| `defaultLevel` | Default logging level (invoked by the `log` method). Default value set in `levels` object (`info` for default `levels`). |\n| `maxLevel`     | Maximum logging level. Default value set in `levels` object (`info` for default `levels`).                               |\n| `levels`       | An alternate levels definition. See below for details.                                                                   |\n\n### Levels Config\n\nHere is the default levels object:\n\n```js\n{\n  emerg: { value: 0, console: 'error' },\n  alert: { value: 1, console: 'error' },\n  crit: { value: 2, console: 'error' },\n  error: { value: 3, console: 'error' },\n  warning: { value: 4, console: 'warn' },\n  notice: { value: 5, console: 'info' },\n  info: { value: 6, console: 'info', default: true, defaultMax: true },\n  debug: { value: 7, console: 'debug' },\n}\n```\n\nEach key will be rendered as a function on the `Logger` instance that takes a list of items, just like `console.log()`.\n\nThe keys on each log level:\n\n| Key          | Description                                           |\n| ------------ | ----------------------------------------------------- |\n| `value`      | Supports setting the logging threshold.               |\n| `console`    | The console function invoked by the log level.        |\n| `default`    | `true` if the `log` method should trigger this level. |\n| `defaultMax` | `true` if default max level.                          |\n\n---\n\nBuilt for you with ❤️ on Bali! Find more great tools \u0026 templates on [my GitHub Profile](https://github.com/karmaniverous).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmaniverous%2Fedge-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarmaniverous%2Fedge-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmaniverous%2Fedge-logger/lists"}