{"id":23662753,"url":"https://github.com/kezhengjie/simplelog","last_synced_at":"2025-10-16T06:21:18.475Z","repository":{"id":163339257,"uuid":"542975419","full_name":"kezhengjie/simplelog","owner":"kezhengjie","description":"You just need to log,so why bother?header-only,single and tiny cpp log lib here!","archived":false,"fork":false,"pushed_at":"2022-09-30T06:02:42.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T03:15:50.674Z","etag":null,"topics":["cpp","cross-platform","easy-to-use","header-only","log","logging","logging-lib","logging-library","out-of-the-box","simple-api","thread-safe","tiny"],"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/kezhengjie.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":"2022-09-29T07:17:05.000Z","updated_at":"2024-01-15T03:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"0127a5bf-f08a-4ea3-ada7-bcf13a7dea8e","html_url":"https://github.com/kezhengjie/simplelog","commit_stats":null,"previous_names":["kezhengjie/simplelog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kezhengjie/simplelog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fsimplelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fsimplelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fsimplelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fsimplelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kezhengjie","download_url":"https://codeload.github.com/kezhengjie/simplelog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhengjie%2Fsimplelog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279162101,"owners_count":26117108,"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-10-16T02:00:06.019Z","response_time":53,"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":["cpp","cross-platform","easy-to-use","header-only","log","logging","logging-lib","logging-library","out-of-the-box","simple-api","thread-safe","tiny"],"created_at":"2024-12-29T05:07:37.931Z","updated_at":"2025-10-16T06:21:18.441Z","avatar_url":"https://github.com/kezhengjie.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simplelog\n`simplelog` a header only log library and aims to provide out-of-the-box log feature and simple API.  \nIt is super tiny and the lines of the code is about 150 but still thread safe.  \nYou just have to log in most scenarios,so why bother?\n\n# Application Scenarios\nsmall projects or non-performance-sensitive projects,just include it and log,no further configuration need to set.  \n\n# Quick Start\n```c++\n#include \u003csimple_log.hpp\u003e\nnamespace sl = simplelog;\n\nint main(int argc, char** argv)\n{\n  sl::Log::Info(\"info message\");\n  sl::Log::Error(\"error message\");\n  sl::Log::Debug(\"debug message\");\n}\n\n```\n\n## Log Name\nBy default,the log file name is your executable name.Assumes that your executable name is `calculate`,  \nthen a file `calculate.log` will be created and logged to whenever any `simple::Log` function is called.  \nYou could also define macro `SIMPLE_LOG_FILENAME` to custom your own log name instead of executable name.  \n\n```c++\n#define SIMPLE_LOG_FILENAME \"trivial.log\"\n#include \u003csimple_log.hpp\u003e\n\n...\n```\n\n## Console\nBy default,`simplelog` will also print log content to stdout.   \nYou could define macro `SIMPLPE_LOG_NO_PRINT` to disable it.  \n\n\n```c++\n#define SIMPLPE_LOG_NO_PRINT\n#include \u003csimple_log.hpp\u003e\n\n...\n```\n\n# Design \n\nThe performance of a widely used C++ log library is normally decent,but it is also huge and perhaps hard to configure.  \nThe library provides simple api and header file that make it easy for anyone to read or DIY.  \n\n\n## Thread Safety\nOn `Windows` an one-time output stream operation is thread safe.  \n```c++\nstd::string s;\nstd::ostream os;\n// it is thread safe on Windows.\nos \u003c\u003c s;\n\n// not thread safe because it is a two-time\n// output stream operation.\nos \u003c\u003c s \u003c\u003c std::endl\n```\nSo on windows,the library use system io to keep log content in sync.  \n\nBut on `Linux`,an one-time output stream operation could be thread safe or not.  \nIt is depends on `Linux` release version or kernel version.  \nSo there's a `mutex` to keep log content in sync on `Linux` version.  \n\n\n## Performance\nThis library is not designed for high performance scenarios.  \nBut on a small project or a non-performance-sensitive project,this library is easy to use and fast to begin coding.  \nIt is also strange when the size of a log library is larger than your own project.  \nYou could create a thread pool and then call `simplelog::Log` function to improve speed because  \nit is thread safe.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhengjie%2Fsimplelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkezhengjie%2Fsimplelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhengjie%2Fsimplelog/lists"}