{"id":21653617,"url":"https://github.com/karnkaul/dlog","last_synced_at":"2025-03-20T04:31:58.679Z","repository":{"id":133375095,"uuid":"307198766","full_name":"karnkaul/dlog","owner":"karnkaul","description":"Dumb logger library","archived":false,"fork":false,"pushed_at":"2022-02-07T12:45:04.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-25T06:11:21.117Z","etag":null,"topics":["cpp","cpp17","cpp17-library","logging"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karnkaul.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":"2020-10-25T21:44:41.000Z","updated_at":"2021-12-16T03:34:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"3301a5ab-12d1-4c70-96cb-ddccf15fef3e","html_url":"https://github.com/karnkaul/dlog","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/karnkaul%2Fdlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karnkaul%2Fdlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karnkaul%2Fdlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karnkaul%2Fdlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karnkaul","download_url":"https://codeload.github.com/karnkaul/dlog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244552039,"owners_count":20470976,"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":["cpp","cpp17","cpp17-library","logging"],"created_at":"2024-11-25T08:19:34.131Z","updated_at":"2025-03-20T04:31:58.672Z","avatar_url":"https://github.com/karnkaul.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dumb Log\n\n[![Build Status](https://github.com/karnkaul/dlog/actions/workflows/ci.yml/badge.svg)](https://github.com/karnkaul/dlog/actions/workflows/ci.yml)\n\nThis is a \"dumb simple\" logging library that uses [fmt](https://github.com/fmtlib/fmt).\n\n## Features\n\n- Publicly integrated `fmt`\n- Reentrant and thread-safe functions\n- MSVC Output Window (`OutputDebugStringA`)\n- Separate `format()` function\n- Log levels: `error`, `warn`, `info`, `debug`\n- Meta-format: add `level`, `thread`, and `timestamp` text around message\n- Async file logging (optional)\n- Attach custom output `pipe`s\n- Customizable output channels (`unsigned char` bit flags)\n\n## Limitations\n\n- `char` and `std::string` support only (no wide strings)\n- No support for domain based logging / filtering\n\n## Usage\n\n### Requirements\n\n- CMake 3.14+\n- C++17 compiler (and stdlib)\n\n### Steps\n\n1. Clone repo to appropriate subdirectory, say `dumb_log`\n1. Add library to project via: `add_subdirectory(dumb_log)` and `target_link_libraries(foo dlog::dlog)`\n1. Use via: `#include \u003cdumb_log/dumb_log.hpp\u003e`\n1. Use only fmt via: `#include \u003cfmt/format.h\u003e`\n\n### Examples\n\n#### Simple\n\n```cpp\ndumb_log::set_log_format(\"[{level}] [T{thread}] {message} [{timestamp}]\");\ndumb_log::info(\"{} and {} successfully initialised\", \"Instance\", \"Device\");\n\n/* output:\n[I] [T0] Instance and Device successfully initialised [21:23:18]\n*/\n```\n\n#### File Logging\n\n```cpp\n{\n  // start thread capturing logs asynchronously into passed file path\n  // backs up existing file if any (suffix can be customized)\n  // obtain RAII handle\n  auto handle = dumb_log::file_logger::attach(\"log.txt\");\n  // ...\n} // thread joined\n```\n\n#### Custom Pipes\n\n```cpp\nstruct my_pipe : dumb_log::pipe {\n  dumb_log::level min_level;\n\n  my_pipe(dumb_log::level min_level) noexcept : min_level(min_level) {}\n\n  void operator()(dumb_log::level l, std::string_view line) const override {\n    if (l \u003e= min_level) {\n      /* custom logic */ \n    }\n  }\n};\n\n{\n  auto handle = dumb_log::pipe::attach\u003cmy_pipe\u003e(dumb_log::level::info);\n  // ...\n}\n```\n\n### Contributing\n\nPull/merge requests are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarnkaul%2Fdlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarnkaul%2Fdlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarnkaul%2Fdlog/lists"}