{"id":15047957,"url":"https://github.com/juzzlin/simplelogger","last_synced_at":"2025-04-10T01:10:41.614Z","repository":{"id":94664925,"uuid":"152899900","full_name":"juzzlin/SimpleLogger","owner":"juzzlin","description":"A simple yet effective logging library for C++","archived":false,"fork":false,"pushed_at":"2025-02-08T12:21:55.000Z","size":65,"stargazers_count":10,"open_issues_count":4,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T01:10:35.262Z","etag":null,"topics":["cplusplus","cplusplus-11","cplusplus-17","cross-platform","library","logger","loggers","logging","logging-library","raii"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juzzlin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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-10-13T18:01:23.000Z","updated_at":"2025-01-28T20:06:29.000Z","dependencies_parsed_at":"2025-01-27T17:33:11.038Z","dependency_job_id":"030ac3c9-081f-43b0-9a8a-b3e549e62ce9","html_url":"https://github.com/juzzlin/SimpleLogger","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzzlin%2FSimpleLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzzlin%2FSimpleLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzzlin%2FSimpleLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzzlin%2FSimpleLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juzzlin","download_url":"https://codeload.github.com/juzzlin/SimpleLogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137886,"owners_count":21053775,"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":["cplusplus","cplusplus-11","cplusplus-17","cross-platform","library","logger","loggers","logging","logging-library","raii"],"created_at":"2024-09-24T21:06:13.951Z","updated_at":"2025-04-10T01:10:41.593Z","avatar_url":"https://github.com/juzzlin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"SimpleLogger\n============\n\nLooking for a simple logger for your C++ project? `SimpleLogger` might be for you.\n\n# Features\n\n* Based on RAII\n* Configurable level symbols\n* Datetime, ISO Datetime, EPOCH, and custom timestamp formats\n* Logging levels: `Trace`, `Debug`, `Info`, `Warning`, `Error`, `Fatal`\n* Log to file and/or console\n* Thread-safe\n* Uses streams (\u003c\u003c operator)\n* Very easy to use\n\n# Installation\n\n## Use from sources\n\nJust add `src/simple_logger.hpp` and `src/simple_logger.cpp` to your project and start using it!\n\n## Use as a CMake subproject (Recommended)\n\nCopy contents of `SimpleLogger` under your main project (or clone as a Git submodule).\n\nIn your `CMakeLists.txt`:\n\n```\nadd_subdirectory(SimpleLogger EXCLUDE_FROM_ALL)\ninclude_directories(SimpleLogger/src)\n```\n\nLink to the library:\n\n```\ntarget_link_libraries(${YOUR_TARGET_NAME} SimpleLogger_static)\n```\n\nIn your code:\n\n```\n#include \"simple_logger.hpp\"\n```\n\n## Use as a library\n\nBuild and install:\n\n`$ mkdir build \u0026\u0026 cd build`\n\n`$ cmake ..`\n\n`$ make`\n\n`$ sudo make install`\n\nLink to `libSimpleLogger_static.a` or `libSimpleLogger.so`.\n\n# Examples\n\nNote: instead of `Logger` class you can simply use `L`.\n\n## Log to console\n\n```\nusing juzzlin::L;\n\nL().info() \u003c\u003c \"Something happened\";\n```\n\nOutputs something like this:\n\n`Sat Oct 13 22:38:42 2018 I: Something happened`\n\n## Log to file and console\n\n```\nusing juzzlin::L;\n\nL::initialize(\"/tmp/myLog.txt\");\n\nL().info() \u003c\u003c \"Something happened\";\n```\n\n## Log only to file\n\n```\nusing juzzlin::L;\n\nL::initialize(\"/tmp/myLog.txt\");\nL::enableEchoMode(false);\n\nL().info() \u003c\u003c \"Something happened\";\n```\n\n## Set logging level\n\n```\nusing juzzlin::L;\n\nL::setLoggingLevel(L::Level::Debug);\n\nL().info() \u003c\u003c \"Something happened\";\nL().debug() \u003c\u003c \"A debug thing happened\";\n```\n\nOutputs something like this:\n\n`Sat Oct 13 22:38:42 2018 I: Something happened`\n\n`Sat Oct 13 22:38:42 2018 D: A debug thing happened`\n\n## Log with a tag\n\n```\nusing juzzlin::L;\n\nL::setLoggingLevel(L::Level::Info);\n\nL(\"MyTag\").info() \u003c\u003c \"Something happened\";\n```\n\nOutputs something like this:\n\n`Sat Oct 13 22:38:42 2018 I: MyTag: Something happened`\n\n## Set custom level symbols\n\n```\nusing juzzlin::L;\n\nL::setLoggingLevel(L::Level::Debug);\nL::setLevelSymbol(L::Level::Debug, \"\u003cDEBUG\u003e\");\n\nL().debug() \u003c\u003c \"A debug thing happened\";\n```\n\nOutputs something like this:\n\n`Sat Oct 13 22:38:42 2018 \u003cDEBUG\u003e A debug thing happened`\n\n## Set timestamp mode and optional timestamp separator\n\nPossible timestamp modes: `None`, `EpochSeconds`, `EpochMilliseconds`, `EpochMicroseconds`, `DateTime`, `ISODateTime`.\n\n```\nusing juzzlin::L;\n\nL::setTimestampMode(L::TimestampMode::EpochMilliseconds);\nL::setTimestampSeparator(\" ## \");\n\nL().info() \u003c\u003c \"Something happened\";\n```\n\nOutputs something like this:\n\n`1562955750677 ## I: Something happened`\n\n## Set custom timestamp format\n\nBy setting a custom timestamp format the timestamp mode is set to `Custom`:\n\n```\nusing juzzlin::L;\n\nL::setCustomTimestampFormat(\"%H:%M:%S_%Y-%m-%d\");\nL::setTimestampSeparator(\" ## \");\n\nL().info() \u003c\u003c \"Something happened\";\n```\n\nOutputs something like this:\n\n`12:34:58_2024-07-06 ## I: Something happened`\n\n## Set custom output stream\n\n```\nusing juzzlin::L;\n\nstd::stringstream ssI;\nL::setStream(L::Level::Info, ssI);\n```\n\n# Requirements\n\nC++17\n\n# Licence\n\nMIT\n\n# Projects currently using SimpleLogger\n\n* https://github.com/juzzlin/DustRacing2D\n\n* https://github.com/juzzlin/Heimer\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuzzlin%2Fsimplelogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuzzlin%2Fsimplelogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuzzlin%2Fsimplelogger/lists"}