{"id":21651669,"url":"https://github.com/hoytech/logdefer-cxx","last_synced_at":"2026-05-16T20:36:47.891Z","repository":{"id":17279080,"uuid":"20049089","full_name":"hoytech/LogDefer-CXX","owner":"hoytech","description":"Log::Defer C++11 implementation","archived":false,"fork":false,"pushed_at":"2015-01-12T21:26:01.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-25T05:42:49.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoytech.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}},"created_at":"2014-05-22T05:34:27.000Z","updated_at":"2015-01-12T21:26:01.000Z","dependencies_parsed_at":"2022-08-04T17:30:41.625Z","dependency_job_id":null,"html_url":"https://github.com/hoytech/LogDefer-CXX","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/hoytech%2FLogDefer-CXX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2FLogDefer-CXX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2FLogDefer-CXX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoytech%2FLogDefer-CXX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoytech","download_url":"https://codeload.github.com/hoytech/LogDefer-CXX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244547602,"owners_count":20470103,"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":"2024-11-25T07:49:09.393Z","updated_at":"2026-05-16T20:36:47.816Z","avatar_url":"https://github.com/hoytech.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"LogDefer-CXX\n============\n\n\nDescription\n-----------\n\nLog::Defer C++11 implementation\n\nThis is a logger implementation of the [Log::Defer](https://metacpan.org/pod/Log::Defer) format in C++11.\n\nIt uses Kazuho Oku's [picojson](https://github.com/kazuho/picojson/) library to serialise messages.\n\n\nUsage\n-----\n\nThe usage tries to be as similar as possible to the reference Perl implementation (although it assumes JSON where the perl one doesn't).\n\nThe basic usage is to create a new `LogDefer` object. The constructor requires one argument: A lambda callback function. This callback will be invoked when the `LogDefer` object's destructor is called. That is, when it goes out of scope or when the last reference to it has been destroyed.\n\nHere is a simple example:\n\n    {\n      LogDefer logger([](const std::string \u0026json) {\n                        // Normally we'd write this to a file/syslog/etc\n                        std::cout \u003c\u003c json \u003c\u003c std::endl;\n                      });\n\n      logger.info(\"Processed some stuff\");\n      logger.warn(\"some warning!\");\n\n    } // \u003c-- logger goes out of scope so callback is invoked now\n\n\nTodo\n----\n\n* Timers (will need to use weak pointers)\n* Data (will need to expose picojson interface)\n* Make sure that the desctructor can't throw exceptions\n\n\n\nSee Also\n--------\n\nThe [Log::Defer](https://metacpan.org/pod/Log::Defer) perl reference implementation\n\nMichael Pucyk's [LogDefer Python module](https://github.com/mikep/LogDefer)\n\nOne way to display these logs is the [log-defer-viz](https://metacpan.org/pod/log-defer-viz) visualisation tool\n\n\nAuthor and Copyright\n--------------------\n\nCopyright (c) 2014 Doug Hoyte\n\nThis library is distributed under the 2-clause BSD license so you can basically do whatever you want with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoytech%2Flogdefer-cxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoytech%2Flogdefer-cxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoytech%2Flogdefer-cxx/lists"}