{"id":19846518,"url":"https://github.com/hekmon/hllogger","last_synced_at":"2025-08-02T02:11:55.832Z","repository":{"id":99435623,"uuid":"123731270","full_name":"hekmon/hllogger","owner":"hekmon","description":"Enhances the golang default logger with syslog inspired facilities and systemd-journald automatic integration","archived":false,"fork":false,"pushed_at":"2022-04-13T13:11:14.000Z","size":39,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T22:52:14.281Z","etag":null,"topics":["go","golang","golang-library","journald","journald-logs","logger","logging","loglevel","systemd-journald"],"latest_commit_sha":null,"homepage":"","language":"Go","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/hekmon.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":"2018-03-03T21:04:36.000Z","updated_at":"2022-02-15T07:20:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"53fcadd5-ce59-4432-ba5e-e7b428f2a24e","html_url":"https://github.com/hekmon/hllogger","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hekmon/hllogger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hekmon%2Fhllogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hekmon%2Fhllogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hekmon%2Fhllogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hekmon%2Fhllogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hekmon","download_url":"https://codeload.github.com/hekmon/hllogger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hekmon%2Fhllogger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268326739,"owners_count":24232496,"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-08-02T02:00:12.353Z","response_time":74,"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":["go","golang","golang-library","journald","journald-logs","logger","logging","loglevel","systemd-journald"],"created_at":"2024-11-12T13:11:43.747Z","updated_at":"2025-08-02T02:11:55.798Z","avatar_url":"https://github.com/hekmon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# High Level Logger\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/hekmon/hllogger/v2?status.svg)](https://pkg.go.dev/github.com/hekmon/hllogger/v2)\n\n\nHlLogger is an opinionated logger on top of the Golang standard library logger. It adds:\n\n* syslog inspired logging facilities such as:\n  * Debug\n  * Info\n  * Notice\n  * Warning\n  * Error\n  * Critical\n  * Alert\n  * Emergency\n* automatic systemd-journald integration if systemd is detected as executor and output is `os.Stdout` or `os.Stderr`\n* automatic AWS CloudWatch Logs integration if AWS Lambda execution environment is detected\n\n## Installation\n\n```bash\ngo get github.com/hekmon/hllogger/v2\n```\n\n## Usage\n\n```golang\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/hekmon/hllogger/v2\"\n)\n\nfunc main() {\n\tlogger := hllogger.New(os.Stdout, hllogger.Debug)\n\tlogger.Debug(\"test\")\n\tlogger.Info(\"test\")\n\tlogger.Notice(\"test\")\n\tlogger.Warning(\"test\")\n\tlogger.Error(\"test\")\n\tlogger.Critical(\"test\")\n\tlogger.Alert(\"test\")\n\tlogger.Emergency(\"test\")\n}\n```\n\nIf you init the logger with the `hllogger.Info` level, all calls to `logger.Debug()` will no-op (won't print anything). If you init the logger with the `hllogger.Notice` level, all calls to to `logger.Debug()` and `logger.Info()` will no-op (won't print anything). And so on...\n\n### Regular output\n\nRegular (default) ouput on your terminal or on a file.\n\n```raw\n2022/02/14 20:37:31     DEBUG: test\n2022/02/14 20:37:31      INFO: test\n2022/02/14 20:37:31    NOTICE: test\n2022/02/14 20:37:31   WARNING: test\n2022/02/14 20:37:31     ERROR: test\n2022/02/14 20:37:31  CRITICAL: test\n2022/02/14 20:37:31     ALERT: test\n2022/02/14 20:37:31 EMERGENCY: test\n```\n\n### systemd-journald integration\n\nAutomatically enabled if started by systemd and output is `os.Stdout` or `os.Stderr`. By integrating with systemd-journald, the lib will indicate the log level of each log to journald. It will allows log manipulation directly with journald (printing only info level while debug have been printed) but also log level highlighting (colors).\n\n#### log level highlighting\n\n![systemd-journald output with color highlighting](journald.png \"systemd-journald output\")\n\n#### emergency broadcast\n\n```bash\nhekmon@testserver1:~$ sudo systemctl start logleveltest.service\n\nBroadcast message from systemd-journald@testserver1 (Mon 2022-02-14 20:47:52 UTC):\n\nhlloggertest[1031126]: EMERGENCY: test\n\nhekmon@testserver1:~$\n```\n\n### AWS Lambda integration\n\nIf a AWS lambda execution environment is detected and therefor logs are being handled by AWS Cloudwatch logs, the logger won't use any time based flags as CloudWatch Logs will be taking care of it. Only log level and actual log message will be output:\n\n```raw\n    DEBUG: test\n     INFO: test\n   NOTICE: test\n  WARNING: test\n    ERROR: test\n CRITICAL: test\n    ALERT: test\nEMERGENCY: test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhekmon%2Fhllogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhekmon%2Fhllogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhekmon%2Fhllogger/lists"}