{"id":13730724,"url":"https://github.com/GeekyMoose/elephant-logger","last_synced_at":"2025-05-08T03:31:35.991Z","repository":{"id":90279273,"uuid":"108945759","full_name":"geekymoose/elephant-logger","owner":"geekymoose","description":"A simple yet flexible C++ logger with customisable categories, outputs, filters, and colors for debugging purpose","archived":false,"fork":false,"pushed_at":"2024-04-17T21:51:47.000Z","size":318,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2024-08-04T02:09:47.497Z","etag":null,"topics":["c-plus-plus","channels","customizable","debug","filters","library","logger","logging","realtime"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geekymoose.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2017-10-31T04:34:47.000Z","updated_at":"2024-04-17T21:18:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"d03d5bad-489a-4380-a41b-6ad1e6b79b31","html_url":"https://github.com/geekymoose/elephant-logger","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/geekymoose%2Felephant-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekymoose%2Felephant-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekymoose%2Felephant-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekymoose%2Felephant-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geekymoose","download_url":"https://codeload.github.com/geekymoose/elephant-logger/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224695666,"owners_count":17354449,"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":["c-plus-plus","channels","customizable","debug","filters","library","logger","logging","realtime"],"created_at":"2024-08-03T02:01:18.568Z","updated_at":"2024-11-14T21:31:31.291Z","avatar_url":"https://github.com/geekymoose.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Elephant logger\n\n![elephantlogger-logo](logo.png)\n\n[![release-version](https://img.shields.io/badge/release-beta--version-red.svg)](\u003c/\u003e)\n[![Build Status](https://travis-ci.org/GeekyMoose/elephant-logger.svg?branch=dev)](\u003chttps://travis-ci.org/GeekyMoose/elephant-logger\u003e)\n[![license](https://img.shields.io/badge/license-Apache-blue.svg)](\u003chttps://github.com/GeekyMoose/elephant-logger-realtime/blob/dev/LICENSE.txt\u003e)\n\n```c++\n// Your code\n#include \u003celephantlogger/log.h\u003e\n\nint main(int argc, char** argv) {\n\n    elephantlogger::init();\n\n    LOG_WTF(\"Log WTF\");\n    LOG_ERROR(\"Log error\");\n    LOG_WARNING(\"Log warning\");\n    LOG_CONFIG(\"Log config\");\n    LOG_INFO(\"Log info\");\n    LOG_TRACE(\"Log trace\");\n    LOG_DEBUG(\"Log debug\");\n\n    LOG_DEBUG(\"Integer value: %d\", 42);\n    LOG_DEBUG(\"Float value: %f\", 31.9);\n    LOG_DEBUG(\"Bool value (true): %d\", true);\n    LOG_DEBUG(\"NULL (Using d): %d\", NULL);\n    LOG_DEBUG(\"NULL (Using s): %s\", NULL);\n\n    LOG_DEBUG(\"String: %s / Integer: %d / Float: %f / Char: %c\", \"Hello\", 2, 7.1, 'c');\n\n    int counter = 0;\n    while(counter \u003c 12) {\n        counter++;\n        LOG_DEBUG(\"Log in loop (counter: %d)\", counter);\n    }\n\n    return 0;\n}\n```\n\n## Description\n\nEasy to use and flexible C++ logger with support for custom outputs and filters.\nThe goal is to easily filter and show the logs on several outputs.\n\n## Work in progress\n\n- API may change.\n- Warning: max log size is 255 chars (truncated if higher).\n- No Windows support tested.\n- Add color console output.\n\n## Features\n\n- Outputs\n  - Builtin outputs\n    - `LogOutput_File`\n    - `LogOutput_Console`\n  - Custom outputs\n    - Implement `LogOutput` interface\n    - Add `LogOutput` in the logger\n- Categories\n  - Default category for easy usage\n  - Up to 64 categories\n  - User defined categories\n- Filters\n  - Category filters (global and output specific)\n  - Log level filters (global and output specific)\n  - Filters can be changed at runtime\n- Enable / disable\n  - Enable logger\n  - Disable logger\n  - Enable a specific output\n  - Disable a specific output\n- Default logging macros\n  - `LOG_WTF(msg, ...)`\n  - `LOG_ERROR(msg, ...)`\n  - `LOG_WARNING(msg, ...)`\n  - `LOG_CONFIG(msg, ...)`\n  - `LOG_INFO(msg, ...)`\n  - `LOG_TRACE(msg, ...)`\n  - `LOG_DEBUG(msg, ...)`\n- Category logging macros\n  - `LOG_WTF_IN(categoryID, msg, ...)`\n  - `LOG_ERROR_IN(categoryID, msg, ...)`\n  - `LOG_WARNING_IN(categoryID, msg, ...)`\n  - `LOG_CONFIG_IN(categoryID, msg, ...)`\n  - `LOG_INFO_IN(categoryID, msg, ...)`\n  - `LOG_TRACE_IN(categoryID, msg, ...)`\n  - `LOG_DEBUG_IN(categoryID, msg, ...)`\n- Configuration macros\n  - `ELEPHANTLOGGER_DISABLED` Totally disable the logger if defined\n  - `ELEPHANTLOGGER_MACROS_DISABLED` Remove the macro definitions (use `elephantlogger::log()` instead)\n  - `ELEPHANTLOGGER_ASSERT_ENABLED` Enable internal assert for debug\n- Printf like log format\n\n## Getting Started\n\n- Add the `include/` folder in your project's include paths.\n- Add `#include \u003celephantlogger/log.h\u003e` in your code.\n- Call `elephantlogger::init()` in your main.\n- Log using `LOG_DBG(\"msg\")` macro (change DGB with any other log levels).\n- Logs are sent to the default output.\n\n```c++\n#include \u003celephantlogger/log.h\u003e\n\nint main(int argc, char** argc) {\n    elephantlogger::init();\n\n    // Your code\n\n    return 0;\n}\n```\n\n## Example with a file output\n\n```c++\n#include \u003cstring\u003e\n#include \u003celephantlogger/log.h\u003e\n#include \u003celephantlogger/outputs/LogOutput_File.h\u003e\n\n// Initialize the logger with custom outputs and categories.\nstatic void elephant_customInit() {\n    static elephantlogger::LogOutput_File filelog(\"elephant.log\");\n\n    elephantlogger::init();\n    elephantlogger::addOutput(\u0026filelog, elephantlogger::LogLevel::Debug);\n}\n\nint main(int argc, char** argv) {\n    elephant_customInit();\n\n    LOG_WARNING(\"Some warning log\");\n    LOG_DEBUG(\"Some debug log\");\n    LOG_ERROR(\"Some error log\");\n    LOG_CONFIG(\"Some config log\");\n    LOG_TRACE(\"Some trace log\");\n    LOG_INFO(\"Some information log\");\n\n    return 0;\n}\n```\n\n## Build the examples\n\n### Requirements\n\n- C++11\n- pragma support (pragma once)\n\n### Build the examples on GNU/Linux with CMake\n\n- [CMake](https://cmake.org/)\n\n```bash\nmkdir build\ncd build\ncmake -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release ..\nmake -j2\nmake run_ex_simple_usage\n```\n\n\u003e `DCMAKE_BUILD_TYPE` options: Debug / Release / RelWithDebInfo / MinSizeRel\n\n## Autoformat\n\nThe autoformat uses `clang-format` to apply the rules.\nYou can autoformat the whole code with the following command:\n\n`clang-format -i -style=file include/**/*.h`\n\n## Examples of codes\n\nSeveral examples are available in the `examples` directory.\n\n## Generate the documentation\n\n- In the root folder, run `doxygen Doxyfile`\n- Documentation generated in `build/doxygen` folder.\n\n## Known BUGs\n\nSee the github [issues-section](https://github.com/GeekyMoose/elephant-logger/issues)\n\n\u003e Warning: in case of wrong log format (e.g., %s instead of %d),\n\u003e you will get weird errors without nice warning information (segfault in the worst case).\n\n## Authors\n\n- Constantin Masson ([GeekyMoose](https://github.com/GeekyMoose))\n- Logo made by Marie-Pier Bouffard ([www.artstation.com/mariepierbouffard](https://www.artstation.com/mariepierbouffard))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeekyMoose%2Felephant-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGeekyMoose%2Felephant-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeekyMoose%2Felephant-logger/lists"}