{"id":19602634,"url":"https://github.com/wang-bin/ezlog","last_synced_at":"2025-10-04T01:31:30.461Z","repository":{"id":1570776,"uuid":"2005533","full_name":"wang-bin/ezlog","owner":"wang-bin","description":"a tiny and easy to use log system  for c/c++","archived":false,"fork":false,"pushed_at":"2014-06-28T13:25:21.000Z","size":461,"stargazers_count":3,"open_issues_count":11,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-14T09:43:23.402Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wang-bin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-07-06T09:03:55.000Z","updated_at":"2015-12-23T18:57:32.000Z","dependencies_parsed_at":"2022-08-28T13:10:34.726Z","dependency_job_id":null,"html_url":"https://github.com/wang-bin/ezlog","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Fezlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Fezlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Fezlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Fezlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wang-bin","download_url":"https://codeload.github.com/wang-bin/ezlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235208944,"owners_count":18953003,"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":[],"created_at":"2024-11-11T09:25:09.401Z","updated_at":"2025-10-04T01:31:30.027Z","avatar_url":"https://github.com/wang-bin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A tiny and flexible log library for C/C++. Written in C.\n\n### Platform tested: linux, win32, wince, mac\n\n## Usage:\n####0.  `#include \"ezlog.h\"` then Initialize ezlog. e.g.\n\n    ezlog_init_default();\n\nThis will display the message to console, and use the format \"YY%-%MM%-%DD% %hh%:%mm%:%ss% {tid:%tid% pid:%pid}[%file%] %func% @%line%: %msg\".\n\nIf you don't want to log to console, you can call `ezlog_set_default_appender(0)` after `ezlog_init_default()`, or just don't call `ezlog_init_default()` at all.\n\nIf you need to log to a file\n\n    ezlog_register_appender(file_appender(\"ezlog.txt\", Append));\n\nIf you want to use other target, you can define your own appender.\n\n\n    typede (*appender)(consttruct {\n        void (*handle)(const char* msg, void* opaque);\n        void (*close)(void* opaque);\n        void *opaque;\n    } appender_t;\n\ne.g.\n\nappender_t.handle is\n\n    void widget_appender_handle(const char* msg, void *opaque) {\n        ((Widget*)opaque)-\u003eshowText(msg);\n    }\n\nappender_t.opaque is your widget instance\n\nand for android\n\n    void android_appender_handle(const char* msg, void *) {\n        __android_log_print(ANDROID_LOG_DEBUG, \"%s\", msg); //TODO: logtag\n    }\n\n\n####1. Setup log message format (aka layout).\nezlog supports global layout and appender specified layout.  \nIf you use ezlog_init_default() before and wanna keep the defaul  \nformat, skip this step. Log message will use the last format you defined.  \n\n**Key words**: YY, MM, DD, hh, mm, ss, ms, tid, pid, file, func, line, msg.  \nIt's easy to understand what they mean, so I will not explain these. A key word must between two \"%\",  \nexcept the first and the last. If string between \"%\" is not a key word, ezlog will print it with out any change.  \nIf use key word func, the complete function name including return type, class, parameters will be supported  \nif compiled with gcc.  \n\nset the global layout:  \n\n    ezlog_set_global_layout(\"MM%-%DD% %hh%:%mm%:%ss% [tid:%tid%]-[%file%] %func% @%line%: %msg\");\n\nor the deprecated one  \n\n    ezlog_init_layout(\"MM%-%DD% %hh%:%mm%:%ss% [tid:%tid%]-[%file%] %func% @%line%: %msg\");\n\n\nIf you use `ezlog_init_default()`, skip this step.\n\nSet an appender's layout:\n\n    void ezlog_set_appender_with_layout(appender handle, const char* format);\n\nThis function will add the appender if not exists.\n\n\n####2.  Start your logging. You can add additional messages. It supports printf like format. If nothing  \nelse you want to put, just keep the parameter empty.\n\n    ezlog_debug(\"Hello, cruel world!\");  \n    ezlog_warn(\"Damn! %s\", __DATE__);  \n    ezlog_debug();                            //Only display the formated keywords message you defined  \n\n\n####3. Clean up. If you use the gcc/clang toolchain (VC not supported yet), it will be called after main() auto.\n\n    ezlog_fini();\n\n\n## Qt Wrapper\n\nQt's logging functions such as qDebug(), qWarning() are designed customizable with your own message handler. This wrapper use ezlog as the handler.  \nIt's very easy to use. just `#include \"qtezlog.h\"`, and call\n\n    ezlog::QtEZLog::install();\n\nThen qDebug(), qWarning() will be formated with ezlog's default layout.  \nTO restore the Qt's default, call\n\n    ezlog::QtEZLog::uninstall();\n\nTo use a new layout, call\n\n    ezlog::QtEZLog::setLayout(const QString\u0026 fmt);\n\n\n\u003e\u003e wbsecg1@gmail.com  \n\u003e\u003e 20120224  \n\u003e\u003e Last updated: 20121202  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-bin%2Fezlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwang-bin%2Fezlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-bin%2Fezlog/lists"}