{"id":15050697,"url":"https://github.com/hotakus/holog","last_synced_at":"2026-04-01T17:18:46.639Z","repository":{"id":233436107,"uuid":"783016827","full_name":"Hotakus/holog","owner":"Hotakus","description":"A highly customizable, low-coupling, multi-platform, user-friendly logging project specifically designed for embedded platforms.  一个高度可定制、低耦合、多平台、多设备、用户友好的日志项目，专门为嵌入式平台设计。","archived":false,"fork":false,"pushed_at":"2024-11-06T23:06:33.000Z","size":805,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T02:29:44.343Z","etag":null,"topics":["c","log","logger","logging","objective-c"],"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/Hotakus.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,"publiccode":null,"codemeta":null}},"created_at":"2024-04-06T17:51:19.000Z","updated_at":"2024-11-06T23:06:37.000Z","dependencies_parsed_at":"2024-04-16T06:46:50.207Z","dependency_job_id":"f812ffa5-2b34-4f99-b804-781b5359e669","html_url":"https://github.com/Hotakus/holog","commit_stats":null,"previous_names":["hotakus/holog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Hotakus/holog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hotakus%2Fholog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hotakus%2Fholog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hotakus%2Fholog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hotakus%2Fholog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hotakus","download_url":"https://codeload.github.com/Hotakus/holog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hotakus%2Fholog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31027774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T04:58:43.976Z","status":"ssl_error","status_checked_at":"2026-03-27T04:58:17.966Z","response_time":164,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["c","log","logger","logging","objective-c"],"created_at":"2024-09-24T21:28:57.315Z","updated_at":"2026-03-27T06:03:32.723Z","avatar_url":"https://github.com/Hotakus.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ccenter\u003e\n  \u003cimg src=\"./assets/holog_banner.png\" title=\"\" alt=\"banner\" data-align=\"center\"\u003e\n\u003ch2 align=\"center\"\u003eHolog\u003c/h2\u003e\n\u003c/center\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cstrong\u003e\n      A highly customizable, low-coupling, multi-platform, user-friendly logging project  \u003cbr\u003e\n    specifically designed for embedded platforms.\n\u003c/strong\u003e\n\u003c/div\u003e\n\n---\n\n### Features：\n- 🔗 Publish-Subscribe Pattern, support multi-devices(abstract logger object)\n- 🖥️ Highly Customizable, user can customize styles of log easily.\n- 🌍 Embedded Platform and multi-system support, Such as FatFs, LittleFS, windows and linux.\n- 🛠️ Support standard output, also compatible with Serial port(need a little of porting).\n- 🚀 Easy-to-use, just need follow example, you can start quickly.\n\n---\n\n### 🚀 Quickly Start：\n\nFirst, you need pull this repo, use SSH:  \n```shell\ngit clone --recurse-submodules git@github.com:Hotakus/holog.git\ncd holog\n```\n\nNow you can use build.sh to build this project, or use your CMakeLists.txt to import this project:\n\n**1️⃣ Use \"CMakeLists.txt\" to import:**  \nin your project(not this project), write below:\n```cmake\n# include \".h\" file\ninclude_directories(./your_holog_path/holog)\n# add holog as subproject\nadd_subdirectory(./your_holog_path/holog)\n\nadd_executable(your_project_exe ${YOUR_SRCS})\n# below the \"add_executable()\", add holog as static lib\ntarget_link_libraries(your_project_exe holog)\n```\nnow, rebuild your project, the holog will be compiled with your project.\n\n**2️⃣ Or use \"build.sh\":**  \nIn the root of HoLog, in shell:\n```shell\n# no parameters, generate 'holog' directory, include holog.a and all header files \n./build.sh\n\n# with '-D' parameters\n# -DHOLOG_USE_TEST : generate holog executable file in ./bin for test\n./build.sh -DHOLOG_USE_TEST\n```\n\n---\n\n### ⌨️ Code Eaxmple\n**1️⃣ Basic usage:**\n```c\n#include \"holog.h\"\nint main() {\n    // initializing HoLog\n    holog_init();\n    \n    // To use HoLog, you need create log device.\n    // holog()-\u003ecreate() has 4 params,\n    // First param    : unique device name\n    // Second param   : holog_device_type_t, device types\n    // Third param    : holog_level_t, log level, can compose different level\n    // Last param     : linefeed, CRLF or LF, adjust according to your situation\n    // tip: if level was not enable, the device will ignore corresponding level \n    holog_device_t *stdout_dev = holog()-\u003ecreate(\"stdout\", HOLOG_DEVICE_TYPE_STDOUT, HOLOG_LEVEL_ALL, HOLOG_LINEFEED_CRLF);\n    holog_device_t *info_dev = holog()-\u003ecreate(\"info_dev\", HOLOG_DEVICE_TYPE_COMMON_FILE, HOLOG_LEVEL_INFO, HOLOG_LINEFEED_LF);\n    holog_device_t *warning_dev = holog()-\u003ecreate(\"warning_dev\", HOLOG_DEVICE_TYPE_COMMON_FILE, HOLOG_LEVEL_WARNING, HOLOG_LINEFEED_LF);\n    holog_device_t *error_dev = holog()-\u003ecreate(\"error_dev\", HOLOG_DEVICE_TYPE_COMMON_FILE, HOLOG_LEVEL_ERROR, HOLOG_LINEFEED_LF);\n    holog_device_t *mix_dev = holog()-\u003ecreate(\"mix_dev\", HOLOG_DEVICE_TYPE_COMMON_FILE, HOLOG_LEVEL_ALL, HOLOG_LINEFEED_LF);\n    \n    // if you enable file support in 'holog_conf.h'\n    // you must set the log path(exclude stdout).\n    holog()-\u003eset_log_path(stdout_dev, NULL);\n    holog()-\u003eset_log_path(info_dev, \"./info.log\");\n    holog()-\u003eset_log_path(warning_dev, \"./warning.log\");\n    holog()-\u003eset_log_path(error_dev, \"./error.log\");\n    holog()-\u003eset_log_path(mix_dev, \"./all.log\");\n    \n    // Next, you must register device to holog.\n    holog()-\u003eregister_device(stdout_dev);\n    holog()-\u003eregister_device(info_dev);\n    holog()-\u003eregister_device(warning_dev);\n    holog()-\u003eregister_device(error_dev);\n    holog()-\u003eregister_device(mix_dev);\n    \n    // Now, you can log out some messages you want.\n    // if you register multi-devices, programe will assign logs automatically to \n    // corresponding devices you registered\n    holog_info(\"This is info %d.\", 123456);\n    holog_warning(\"This is warning 0x%x.\", 0xdeadbeef);\n    holog_error(\"This is %s.\", \"error.\");\n    \n    // deinit HoLog\n    holog_deinit();\n    return 0;\n}\n```\n**Run:**\n```shell\n./build.sh -DHOLOG_USE_TEST\ncd ./bin/ \u0026\u0026 ./holog\n```\nYou will get:  \n\u003cimg src=\"./assets/out1.png\" title=\"\" alt=\"banner\" data-align=\"center\"\u003e  \nand you will see file: `info.log`, `warning.log`, `error.log`, `all.log` ,  \nThe all level logs will be broadcast to corresponding devices.\n\nDon't worry about this style, because you can customize it in `holog_conf.h`.\n\n**2️⃣ FatFs usage:**\n```c\n#include \"holog.h\"\nint main() {\n    // init your FatFs\n    your_fatfs_init();\n    \n    holog_init();\n    \n    holog_device_t *fatfs_dev = holog()-\u003ecreate(\"fatfs_dev\", HOLOG_DEVICE_TYPE_FATFS, HOLOG_LEVEL_ALL, HOLOG_LINEFEED_LF);\n    holog()-\u003eset_log_path(fatfs_dev, \"0:/all.log\"); /* FatFs device, log info to all.log, the \"0:/\" is your fatfs mount point */\n    holog()-\u003eregister_device(fatfs_dev);\n    holog_info(\"Log to FatFs.\");\n    \n    holog_deinit();\n    return 0;\n}\n```\n\n**3️⃣ Auto file name by date:**  \nIn `holog_conf.h`, enable the definition `HOLOG_AUTO_FILE_CREATE_BY_DATE`  \nNow, the `holog()-\u003eset_log_path(your_dev, \"0:/all.log\")` must be changed to `holog()-\u003eset_log_path(fatfs_dev, \"0:/\")`   \nThe file path must be directory.\n\n---\n\n### 🛠️ Configuring 'holog_conf.h' \n`holog_conf.h` has many customizable options, you can explore step by step.  \nI will show some options for you.\n\n1️⃣: `HOLOG_GET_TIMESTAMP()`  \nThe definition must be set, if you don't use windows or linux, such as ARM platform.  \nIt receive a timestamp, such as `1713717037`, it is mean `2024/4/22 00:30:37`\n\n2️⃣: `HOLOG_USE_COLOR`: Default enable  \n3️⃣: `HOLOG_LOG_LEVEL_STYLE`: level tip and level color, such as the error level is red, tip is [E]   \n4️⃣: `HOLOG_LOG_STYLE_LIST` : Per log sentence was split 4 parts, custom each part.\n\n**Look `holog_conf.h` to learn more.**\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotakus%2Fholog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhotakus%2Fholog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotakus%2Fholog/lists"}