{"id":16214826,"url":"https://github.com/lecrapouille/mylogger","last_synced_at":"2025-04-07T22:30:02.691Z","repository":{"id":115857135,"uuid":"255566107","full_name":"Lecrapouille/MyLogger","owner":"Lecrapouille","description":"[Lib][Functional] Basic logger for my GitHub C++ projects","archived":false,"fork":false,"pushed_at":"2023-01-09T21:47:41.000Z","size":72,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T23:45:06.954Z","etag":null,"topics":["log","logger","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/Lecrapouille.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-14T09:28:36.000Z","updated_at":"2023-10-04T19:53:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8dec018-0e8e-40c8-a602-2b3264926759","html_url":"https://github.com/Lecrapouille/MyLogger","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/Lecrapouille%2FMyLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lecrapouille","download_url":"https://codeload.github.com/Lecrapouille/MyLogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247740380,"owners_count":20988203,"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":["log","logger","logging"],"created_at":"2024-10-10T11:13:07.847Z","updated_at":"2025-04-07T22:30:02.686Z","avatar_url":"https://github.com/Lecrapouille.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyLogger\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://github.com/Lecrapouille/MyLogger/blob/master/LICENSE)\n[![CI testing](https://github.com/Lecrapouille/MyLogger/actions/workflows/ci.yml/badge.svg)](https://github.com/Lecrapouille/MyLogger/actions/workflows/ci.yml)\n\n[MyLogger](https://github.com/Lecrapouille/MyLogger)\nis an ultra basic but thread safe file logger used for my GitHub C++ projects.\nI used MyLogger for having logs in a file instead of poluting the console\n(stdout and stderr).\n\nDear user, I do not recommend to use it, there are better alternative you can have\nusing complex logging mechanism (rolling, asynchrone logs ...) i.e.\nhttps://github.com/gabime/spdlog instead. This project is here for solving\nsome needs of mine.\n\n## Prerequisite\n\nhttps://github.com/Lecrapouille/MyMakefile downloaded as git submodule.\n\n## Compilation and Installation\n\n```\ngit clone https://github.com/Lecrapouille/MyLogger.git --recurse-submodules\ncd MyLogger\nmake\nsudo make install\n```\n\nTwo libraries (static and shared) have been created. You can change the default compiler by passing `CXX=` to make (ie `make CXX=clang++-7`).\n\nThe project will be installed in `/usr/share/MyLogger/0.1`,\ncompiled libraries will be installed in `/usr/lib`\nHeader and include files will be installed in `/usr/include/MyLogger-0.1`.\n\nYou can pass `DESTDIR` and `PREFIX to` `make install` to modify destination folders.\n\n## Example\n\nSee `tests/LoggerTests.cpp` for a threaded example.\nSee `examples/main.cpp` for basic example:\n\n```\n#include \u003cMyLogger/Logger.hpp\u003e\n\nnamespace project\n{\n  static Info info(\n    // Compiled in debug or released mode\n    true,\n    // Project name used for logs and GUI.\n    \"MyLoggerExample\",\n    // Major version of project\n    0u,\n    // Minor version of project\n    1u,\n    // git SHA1\n    \"3a2b3791f7cca5188259ae01d39c6194d2708c9f\",\n    // git branch\n    \"master\",\n    // Pathes where default project resources have been installed\n    // (when called  by the shell command: sudo make install).\n    \"/home/qq/MyGitHub/MyLogger:/usr/share/MyLogger/0.1\",\n    // Location for storing temporary files\n    \"/tmp/MyLogger/\",\n    // Give a name to the default project log file.\n    \"MyLoggerExample.log\",\n    // Define the full path for the project.\n    \"/tmp/MyLogger/MyLoggerExample.log\"\n  );\n}\n\n// Compilation: g++ --std=c++11 main.cpp -o app `pkg-config --cflags --libs mylogger`.\nint main()\n{\n    CONFIG_LOG(project::info);\n\n    LOGI(\"An information %s %d\", \"the info\", 42);\n    LOGD(\"A debug %s\", \"the debug\"); // Displayed only if -UNDEBUG is passed to compiler\n    LOGW(\"A warning %s\", \"the warning\");\n    LOGF(\"A failure %s\", \"the failure\");\n\n    return 0;\n}\n```\n\nConsole output:\n\n```\nLog created: '/tmp/MyLogger/MyLoggerExample.log'\n```\n\nLog content:\n\n```\n======================================================\n  MyLoggerExample Debug 0.1 - Event log - [2020/08/28]\n  git branch: master\n  git SHA1: 3a2b3791f7cca5188259ae01d39c6194d2708c9f\n======================================================\n\n[19:00:20][INFO][main.cpp::38] An information the info\n[19:00:20][DEBUG][main.cpp::39] A debug the debug\n[19:00:20][WARNING][main.cpp::40] A warning the warning\n[19:00:20][FAILURE][main.cpp::41] A failure the failure\n\n======================================================\n  MyLoggerExample log closed at [19:00:20]\n======================================================\n```\n\n## Gedit coloration\n\nFrom the `gedit/` folder, move:\n- *.lang files to `/usr/share/gtksourceview-3.0/language-specs`\n- *.xml files to `/usr/share/gtksourceview-3.0/styles`\n\nThen inside Gedit go to `Settings, Police and colors` and select\nthe new theme `Lecrapouille Logs`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fmylogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flecrapouille%2Fmylogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fmylogger/lists"}