{"id":17137023,"url":"https://github.com/sinisterrectus/jsonlog","last_synced_at":"2025-03-24T06:43:19.516Z","repository":{"id":69192199,"uuid":"148405585","full_name":"SinisterRectus/JSONLog","owner":"SinisterRectus","description":"JSON metadata logger and analyzer","archived":false,"fork":false,"pushed_at":"2019-12-03T18:56:48.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T07:44:32.829Z","etag":null,"topics":["discord","lua","luvit"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/SinisterRectus.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-09-12T01:53:40.000Z","updated_at":"2022-08-24T15:07:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"f736250e-6081-489c-8a42-812391a7fdd5","html_url":"https://github.com/SinisterRectus/JSONLog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinisterRectus%2FJSONLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinisterRectus%2FJSONLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinisterRectus%2FJSONLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinisterRectus%2FJSONLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SinisterRectus","download_url":"https://codeload.github.com/SinisterRectus/JSONLog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245224003,"owners_count":20580362,"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":["discord","lua","luvit"],"created_at":"2024-10-14T20:06:02.400Z","updated_at":"2025-03-24T06:43:19.509Z","avatar_url":"https://github.com/SinisterRectus.png","language":"Lua","readme":"# JSONLog\r\n\r\nJSON metadata logger and analyzer written in Lua for the Luvit framework.\r\n\r\nInitially written for logging Discord WebSocket payloads, but can be used for any [dkjson](http://dkolf.de/src/dkjson-lua.fsl/home)-compatible data.\r\n\r\nWork-in-progress.\r\n\r\n### Instructions\r\n\r\n- Initialize a `JSONLog` object with a log name as its only argument.\r\n- Add a key, value pair to the log with `JSONLog:add(k, v)`\r\n- To cache the log's state for future use, call `JSONLog:dumpState()`. The filename `\u003cname\u003e_state.json` is used.\r\n- To output a human-readable analysis of the logged JSON, call `JSONLog:dumpPretty()`. The filename `\u003cname\u003e_pretty.txt` is used.\r\n- Optionally call `JSONLog:startLoop(ms)` to initilize a loop that periodically calls `JSONLog:dumpState()` and `JSONLog:dumpPretty()`\r\n- Optionally call `JSONLog:stopLoop()` to stop the dump loop.\r\n\r\n### Discordia Example\r\n\r\n```lua\r\nlocal discordia = require('../discordia') -- adjust path as necessary\r\nlocal JSONLog = require('./JSONLog') -- adjust path as necessary\r\nlocal json = require('json')\r\n\r\nlocal client = discordia.Client()\r\n\r\nlocal log = JSONLog('events')\r\n\r\nlocal ms = discordia.Time.fromSeconds(30):toMilliseconds()\r\nlog:startLoop(ms)\r\n\r\nclient:on('ready', function() return print('ready') end)\r\n\r\nclient:on('raw', function(str)\r\n\tlocal payload = json.decode(str, 1, json.null)\r\n\tif payload.op == 0 then\r\n\t\tlog:add(payload.t, payload.d)\r\n\tend\r\nend)\r\n\r\nclient:run('\u003cTOKEN\u003e')\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinisterrectus%2Fjsonlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinisterrectus%2Fjsonlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinisterrectus%2Fjsonlog/lists"}