{"id":17125348,"url":"https://github.com/danielblagy/yelloger","last_synced_at":"2025-07-08T06:33:12.662Z","repository":{"id":184866047,"uuid":"337100626","full_name":"danielblagy/Yelloger","owner":"danielblagy","description":"Simple thread-safe single-header C++ 17 logger.","archived":false,"fork":false,"pushed_at":"2021-06-02T05:50:36.000Z","size":22,"stargazers_count":22,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T06:14:05.763Z","etag":null,"topics":["cpp-library","cpp17","header-only","log-priorities","logger","thread-safe","thread-safe-logger","timestamps-format"],"latest_commit_sha":null,"homepage":"","language":"C++","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/danielblagy.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}},"created_at":"2021-02-08T14:21:54.000Z","updated_at":"2025-01-12T21:06:54.000Z","dependencies_parsed_at":"2023-07-30T17:43:20.475Z","dependency_job_id":null,"html_url":"https://github.com/danielblagy/Yelloger","commit_stats":null,"previous_names":["danielblagy/yelloger"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielblagy%2FYelloger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielblagy%2FYelloger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielblagy%2FYelloger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielblagy%2FYelloger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielblagy","download_url":"https://codeload.github.com/danielblagy/Yelloger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670435,"owners_count":21142904,"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-library","cpp17","header-only","log-priorities","logger","thread-safe","thread-safe-logger","timestamps-format"],"created_at":"2024-10-14T18:44:44.096Z","updated_at":"2025-04-13T06:14:10.851Z","avatar_url":"https://github.com/danielblagy.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yelloger\n* [General Info](#motivation)\n* [Reference](#reference-contents)\n## A simple thread-safe single-header C++ 17 logger.\n### Motivation\nThis logger was initially made for a [Youtube tutorial](https://youtube.com/playlist?list=PL5Lk2LPoiyAKcw7T-_FB_4BNrWkxfwnus).\n### Include\nThis is a header-only library consisting of one header file. Simply copy the [include/yelloger.h](include/yelloger.h) file and `#include` it in your project.\n### Simple Example\nConsole logging (the simplest use case)\n```cpp\n#include \u003cyelloger.h\u003e\n\nint main()\n{\n\tconst char* name = \"User\";\n\tYellog::Info(\"Hello %s\", name);\n\t\n\treturn 0;\n}\n```\nOutput:\n\u003e 15:07:31  15-02-2021    [Info]     Hello User\n\n\n###  Quick Start\nYellog doesn't need to be instantiated, just include the header and use it like this\n```cpp\n\tYellog::Info(\"Infotmation %d\", int_value);\n```\n, also there is no need to put newline character at the end of the message, it will be done automatically.\n\n\n## Reference Contents\n* [Log Priorities](#log-priorities)\n* [Logging](#logging)\n* [File Output](#file-output)\n* [Timestamps](#timestamps)\n\n## Reference\n\n### Log Priorities\nThe default log priority is `Yellog::InfoPriority`. You can set priority by calling\n```cpp\n\tYellog::SetPriority(Yellog::DebugPriority);\t// e.g. Yellog::DebugPriority\n```\n\nPossible values:\n```cpp\n\tYellog::TracePriority\n\tYellog::DebugPriority\n\tYellog::InfoPriority\n\tYellog::WarnPriority\n\tYellog::ErrorPriority\n\tYellog::CriticalPriority\n```\n  \nYou can get priority by calling\n```cpp\n\tYellog::GetPriority();\t// will return Yellog::InfoPriority if Yellog::SetPriority hasn't been called before\n```\n\n\n### Logging\nTo log:\n```cpp\n\tYellog::Trace(const char* message, Args... args)\t\t// log a message with trace priority\n\tYellog::Debug(const char* message, Args... args)\t\t// log a message with debug priority\n\tYellog::Info(const char* message, Args... args)\t\t\t// log a message with info priority\n\tYellog::Warn(const char* message, Args... args)\t\t\t// log a message with warn priority\n\tYellog::Error(const char* message, Args... args)\t\t// log a message with error priority\n\tYellog::Critical(const char* message, Args... args)\t\t// log a message with critical priority\n```\n\nAs args you can provide primitives and C-strings. Formatting follows [printf format](https://www.cplusplus.com/reference/cstdio/printf/).\n\n\n### File Output\nTo enable file output, call\n```cpp\n\tYellog::EnableFileOutput(\"mylogpath/mylog.txt\");\n```\nbefore using the logger.  \n  \nOptionally, you can provide no path\n```cpp\n\tYellog::EnableFileOutput();\n```\nthen, the logs will be saved in '/log.txt'.  \n  \nTo get the current filepath for file logging, call\n```cpp\n\tYellog::GetFilepath();\n```\nif file output was not enabled, the filepath will contain NULL, otherwise a const char* value will be returned.  \n  \nTo check if file output was enabled and file was successfully opened, call\n```cpp\n\tYellog::IsFileOutputEnabled();\t// returns true if success, false if failure\n```\n\n\n### Timestamps\nFormat follows ctime [strftime format specification](https://www.cplusplus.com/reference/ctime/strftime/).  \nDefault format is \"%T  %d-%m-%Y\" (e.g. 13:20:25  14-02-2021).  \n4 spaces are added automatically to the end of timestamp each time the message is logged.  \n  \nTo set a log timestamp format, call\n```cpp\n\tYellog::SetTimestampFormat(\"%c\");\t// e.g. Thu Aug 23 14:55:02 2001\n```  \n  \nTo get the current log timestamp format, call\n```cpp\n\tYellog::GetTimestampFormat();\t// e.g. \"13:20:25  14-02-2021\"\n```  \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielblagy%2Fyelloger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielblagy%2Fyelloger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielblagy%2Fyelloger/lists"}