{"id":15497427,"url":"https://github.com/heapwolf/net-log","last_synced_at":"2025-10-24T18:44:28.118Z","repository":{"id":16712734,"uuid":"19469611","full_name":"heapwolf/net-log","owner":"heapwolf","description":"a very fast network-based application logger","archived":false,"fork":false,"pushed_at":"2014-05-12T20:08:28.000Z","size":303,"stargazers_count":39,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-18T14:49:15.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/heapwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-05T20:12:37.000Z","updated_at":"2024-08-31T07:47:19.000Z","dependencies_parsed_at":"2022-08-25T13:40:27.796Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/net-log","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heapwolf/net-log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fnet-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fnet-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fnet-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fnet-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/net-log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fnet-log/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272475587,"owners_count":24940719,"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","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-10-02T08:33:41.075Z","updated_at":"2025-10-24T18:44:23.088Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","readme":"# SYNOPSIS\n\nA faster application logger.\n\n# MOTIVATION\n\n- Avoid disk I/O.\n- Minimize moving parts on the client, avoid unnecessary boolean logic and \nfunction calls.\n- No ip addesses or urls to keep track of.\n- A single transport protocol.\n- A many clients to many servers design that is network-partition tolerant.\n- JSON is great, client isn't concerned with\n[`formatting or transforming output`](https://github.com/hij1nx/logmap).\n- `node-bunyan` and `winston` are pathologically complex.\n\n# PERFORMANCE\n\nWhen disabled, has less impact than a logger with a function that does a \nboolean check.\n```\nsetter disabled x 56,931,283 ops/sec ±0.69% (97 runs sampled)\nfunction disabled x 22,490,243 ops/sec ±34.06% (96 runs sampled)\n```\n\nWhen enabled, its faster to log to servers than with tcp.\n```\ntcp-setter enabled x 539,357 ops/sec ±13.50% (69 runs sampled)\ntcp-function enabled x 441,418 ops/sec ±37.98% (51 runs sampled)\nudp-setter enabled x 46,784,099 ops/sec ±0.99% (84 runs sampled)\n```\n\nLogging to the file system is expensive.\n```\nudp x 1,336,037 ops/sec ±42.31% (35 runs sampled)\nfs x 73,242 ops/sec ±1.44% (74 runs sampled)\n```\n\nThe above benchmarks were run on `Darwin 13.1.0 Darwin Kernel Version 13.1.0` \nusing node `v0.10.28`.\n\n# USAGE\n\n## CLIENT EXAMPLE\n\nA client broadcasts to all available servers using datagrams. Packet loss \nin-data-center is rare but acceptable because there are multiple servers\nreceiving logs that can replicate. The result is eventually consistent.\n\nDon't bother with formatting like `logger.info('value: %d', 50)`, the end\npoints should be responsible for that!\n\nDon't specify servers, no need to maintain and distribute lists of end points\nbecause of broadcasting!\n\nA `level` is expected in your JSON. `verbose`, `info`, or `error` are the\ndefaults.\n\n```js\nvar Logger = require('net-log')\nvar logger = Logger.createClient()\n\nsetInterval(function() {\n\n  logger.next = { info: 'foobar', value: 50 }\n\n}, 100)\n\nsetInterval(function() {\n\n  logger.next = { error: 'bazz', value: 100 }\n\n}, 1000)\n```\n\n## CLIENT API\nThe client will respond to `SIGUSR2` to turn on and off logging.\n\n### `createClient(\u003coptions\u003e)`\n**`[local=false]`**\nIf logs should be printed to `process.stdout`.\n\n**`[port=3000]`**\nA numeric value. The port for the client to broadcast to.\n\n**`[enabled=true]`**\nA boolean value. usually dependant on an operating system environment \nvariable.\n\n**`[broadcastAddress=255.255.255.255]`**\nThe broadcast address to send on.\n\n**`[level='verbose']`** A string that determines the current logging \nlevel.\n\n**`[levels={}]`** Provide custom logging level definitions.\n\n```json\n{\n  \"quiet\": -1,\n  \"verbose\": 0,\n  \"info\": 1,\n  \"error\": 2\n}\n```\n\n## SERVER EXAMPLE\n\nThe server will listen on a broadcast address for messages. The server can\nreplicate with other servers if you want.\n\n```js\nvar leveldb = require('level')('./db', { valueEncoding: 'json' })\n\nvar Logger = require('net-log')\nvar server = Logger.createServer({ db: leveldb })\n\nserver.on('log', function(data, info) {\n\n})\n```\n\n## SERVER API\n`createServer` returns an event emitter that will emit `log` or `error`.\n\n### `createServer(\u003coptions\u003e)`\n**`[port]`**\nA numeric value. The port for the client to broadcast to.\n\n**`[boradcastAddress=255.255.255.255`**\nThe broadcast address to listen on.\n\n# TODO\n\nTests should introduce network lag and packet loss.\n\n# LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Paolo Fragomeni, Mic Networks Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fnet-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Fnet-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fnet-log/lists"}