{"id":21269788,"url":"https://github.com/prashantrahul141/nhlog","last_synced_at":"2026-05-21T10:02:34.716Z","repository":{"id":253867977,"uuid":"844746493","full_name":"prashantrahul141/nhlog","owner":"prashantrahul141","description":"An extremely simple logging library for C/C++ with colors.","archived":false,"fork":false,"pushed_at":"2025-02-11T12:38:54.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T13:41:02.189Z","etag":null,"topics":["c","cpp","logging"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prashantrahul141.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T22:24:04.000Z","updated_at":"2025-02-11T12:38:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"8dd9270d-658b-4f37-9fcf-36f28e02dafe","html_url":"https://github.com/prashantrahul141/nhlog","commit_stats":null,"previous_names":["prashantrahul141/nhlog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantrahul141%2Fnhlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantrahul141%2Fnhlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantrahul141%2Fnhlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantrahul141%2Fnhlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prashantrahul141","download_url":"https://codeload.github.com/prashantrahul141/nhlog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243725542,"owners_count":20337667,"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","cpp","logging"],"created_at":"2024-11-21T08:11:54.085Z","updated_at":"2026-05-21T10:02:34.711Z","avatar_url":"https://github.com/prashantrahul141.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nhlog\n\nAn extremely simple logging library for C/C++ with colors.\n\n![demo](./meta/demo.png)\n\n# Installation\n\nJust include the two files `nhlog.h` and `nhlog.c` with your project files and make sure to compile and link them with your project and it just works.\n\n\n# Usage\n\n```c\n/* all logging can be disabled completely at compile time by defining NHLOG_DISABLE, see nhlog.h */\n// #define NHLOG_DISABLE\n\n#include \"nhlog.h\"\n\nint main() {\n  /* Zero initialisation needed */\n  TRACE(\"least important messages\");\n  DEBUG(\"debug messages\");\n  INFO(\"general info message\");\n  WARN(\"warnings\");\n  ERROR(\"errors\");\n  FATAL(\"unrecoverable crashes\");\n\n  /* Logging level can be changed at runtime using: */\n  nhlog_set_level(NHLOG_INFO);\n  TRACE(\"this will be NOT be logged\");\n  WARN(\"however this will be logged\");\n\n  /* All logging can be disabled by setting log level to NHLOG_OFF */\n  nhlog_set_level(NHLOG_OFF);\n  TRACE(\"this will be NOT be logged\");\n\n  nhlog_set_level(NHLOG_TRACE);\n\n  /* you can log to any stream by passing it to nhlog_set_outstream */\n  FILE *fd = fopen(\"logs.txt\", \"w\");\n  nhlog_set_outstream(fd);\n\n  /* you may also want to disable color output for files*/\n  nhlog_set_output_colors(false);\n\n  TRACE(\"these messages will now be logged to the file.\");\n  DEBUG(\"debug message\");\n  fclose(fd);\n\n  /* setting to null defaults to stderr */\n  nhlog_set_output_colors(true);\n  nhlog_set_outstream(NULL);\n\n  /* by default output stream if flushed after every log event, but it can be\n   * disabled */\n  nhlog_set_immediate(false);\n\n  TRACE(\"These messages will be now buffered by the c runtime\");\n\n  return 0;\n}\n```\n\n# Why?\n\nBecause every other C/C++ logging library is either\n\n- overly complicated for small projects\n- doesn't support both c and c++\n- doesn't have colors\n- doesn't have simple api\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashantrahul141%2Fnhlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprashantrahul141%2Fnhlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashantrahul141%2Fnhlog/lists"}