{"id":18919497,"url":"https://github.com/kurotych/logc","last_synced_at":"2025-09-01T08:06:47.346Z","repository":{"id":144474255,"uuid":"219187136","full_name":"kurotych/logc","owner":"kurotych","description":"A simple thread safe logging library implemented in C99","archived":false,"fork":false,"pushed_at":"2019-11-03T09:23:02.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T12:47:11.549Z","etag":null,"topics":["c","c99","cplusplus","log","logger","logging","logging-library","thread-safe"],"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/kurotych.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-11-02T17:13:14.000Z","updated_at":"2023-08-24T09:40:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"4df6d957-03b4-432b-94e3-d6ddbaf2c83b","html_url":"https://github.com/kurotych/logc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kurotych/logc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotych%2Flogc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotych%2Flogc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotych%2Flogc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotych%2Flogc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kurotych","download_url":"https://codeload.github.com/kurotych/logc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotych%2Flogc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273093234,"owners_count":25044436,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","c99","cplusplus","log","logger","logging","logging-library","thread-safe"],"created_at":"2024-11-08T10:38:01.368Z","updated_at":"2025-09-01T08:06:47.310Z","avatar_url":"https://github.com/kurotych.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logc\nA simple thread safe logging library implemented in C99\n\n## Fork of [log.c](https://github.com/rxi/log.c)\n### Main changes\n- Fix concurrency vulnerabilities\n- Thread safe by default (The code should be compiled with -pthread flag)\n- Call abort() after fatal log\n- Color print by default\n\n![screenshot](https://cloud.githubusercontent.com/assets/3920290/23831970/a2415e96-0723-11e7-9886-f8f5d2de60fe.png)\n\n\n## Usage\n**[log.c](src/log.c?raw=1)** and **[log.h](src/log.h?raw=1)** should be dropped\ninto an existing project and compiled along with it. The library provides 6\nfunction-like macros for logging:\n\n```c\nlog_trace(const char *fmt, ...);\nlog_debug(const char *fmt, ...);\nlog_info(const char *fmt, ...);\nlog_warn(const char *fmt, ...);\nlog_error(const char *fmt, ...);\nlog_fatal(const char *fmt, ...);\n```\n\nEach function takes a printf format string followed by additional arguments:\n\n```c\nlog_trace(\"Hello %s\", \"world\")\n```\n\nResulting in a line with the given format printed to stderr:\n\n```\n20:18:26 TRACE src/main.c:11: Hello world\n```\n\n## Test build\n```\ngcc -o test -Wall test.c ./src/log.c -pthread\n```\n\n#### log_quiet_set(int enable)\nQuiet-mode can be enabled by passing `1` to the `log_set_quiet()` function.\nWhile this mode is enabled the library will not output anything to stderr, but\nwill continue to write to the file if one is set.\n\n\n#### log_level_set(int level)\nThe current logging level can be set by using the `log_set_level()` function.\nAll logs below the given level will be ignored. By default the level is\n`LOG_TRACE`, such that nothing is ignored.\n\n#### log_multithreading(bool enable);\nMultithreaded mode is enabled by default.\nSet false only if your program is single threaded.\n\n#### log_file_open(const char* file_path)\nThe data written to the file output is of the following format:\n\n```\n2047-03-11 20:18:26 TRACE src/main.c:11: Hello world\n```\n\n#### log_file_close()\nClose log file stream.\n\n#### LOG_NO_USE_COLOR\nIf the library is compiled with `-DLOG_NO_USE_COLOR` ANSI color escape codes will\nnot be used when printing.\n\n\n## License\nThis library is free software; you can redistribute it and/or modify it under\nthe terms of the MIT license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurotych%2Flogc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkurotych%2Flogc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurotych%2Flogc/lists"}