{"id":26826725,"url":"https://github.com/hslam/log","last_synced_at":"2026-04-30T10:38:18.837Z","repository":{"id":55531684,"uuid":"234187799","full_name":"hslam/log","owner":"hslam","description":"Package log implements multilevel logging.","archived":false,"fork":false,"pushed_at":"2023-05-17T13:55:34.000Z","size":536,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-27T18:04:44.531Z","etag":null,"topics":["go","golang","logger","multilevel"],"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/hslam.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}},"created_at":"2020-01-15T22:41:22.000Z","updated_at":"2023-06-07T08:47:52.000Z","dependencies_parsed_at":"2022-08-15T02:40:34.195Z","dependency_job_id":null,"html_url":"https://github.com/hslam/log","commit_stats":null,"previous_names":[],"tags_count":7,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246313695,"owners_count":20757446,"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":["go","golang","logger","multilevel"],"created_at":"2025-03-30T11:30:44.784Z","updated_at":"2026-04-30T10:38:13.811Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log\n[![GoDoc](https://godoc.org/github.com/hslam/log?status.svg)](https://godoc.org/github.com/hslam/log)\n[![Build Status](https://github.com/hslam/log/workflows/build/badge.svg)](https://github.com/hslam/log/actions)\n[![codecov](https://codecov.io/gh/hslam/log/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/log)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/log?v=7e100)](https://goreportcard.com/report/github.com/hslam/log)\n[![GitHub release](https://img.shields.io/github/release/hslam/log.svg)](https://github.com/hslam/log/releases/latest)\n[![LICENSE](https://img.shields.io/github/license/hslam/log.svg?style=flat-square)](https://github.com/hslam/log/blob/master/LICENSE)\n\nPackage log implements multilevel logging.\n\n## Feature\n* Custom prefix\n* Multiple levels\n* Highlight color\n* File line\n* Call stack\n\n## Level\n* All\n* Trace\n* Debug\n* Info\n* Notice\n* Warn\n* Error\n* Panic\n* Fatal\n* Off\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/log\n```\n### Import\n```\nimport \"github.com/hslam/log\"\n```\n### Usage\n#### Example\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/log\"\n)\n\nfunc main() {\n\tlogger := log.New()\n\tlogger.SetPrefix(\"LogPrefix\")\n\tlogger.SetLevel(log.AllLevel)\n\tlogger.SetHighlight(true)\n\tlogger.SetLine(true)\n\n\tlogger.Assertf(1 == 1, \"%d %s %t\", 1024, \"HelloWorld\", true)\n\n\tlogger.Allf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Tracef(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Debugf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Infof(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Noticef(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Warnf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tlogger.Errorf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\tdefer func() {\n\t\trecover()\n\t\tlogger.Fatalf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n\t}()\n\tlogger.Panicf(\"%d %s %t\", 1024, \"HelloWorld\", true)\n}\n```\n\n### Output\n\n```\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [ALL] [main.go:16] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [TRACE] [main.go:17] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [DEBUG] [main.go:18] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [INFO] [main.go:19] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [NOTICE] [main.go:20] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [WARN] [main.go:21] [\"1024 HelloWorld true\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [ERROR] [main.go:22] [\"1024 HelloWorld true\"] [stack=\"main.main\\n\\t/Users/huangmeng/go/src/github.com/hslam/tmp/log/main.go:22\\nruntime.main\\n\\t/usr/local/go/src/runtime/proc.go:250\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [PANIC] [main.go:27] [\"1024 HelloWorld true\"] [stack=\"main.main\\n\\t/Users/huangmeng/go/src/github.com/hslam/tmp/log/main.go:27\\nruntime.main\\n\\t/usr/local/go/src/runtime/proc.go:250\"]\n[LogPrefix] [2023/05/13 18:21:51.183 +08:00] [FATAL] [main.go:25] [\"1024 HelloWorld true\"] [stack=\"main.main.func1\\n\\t/Users/huangmeng/go/src/github.com/hslam/tmp/log/main.go:25\\nruntime.gopanic\\n\\t/usr/local/go/src/runtime/panic.go:884\\nmain.main\\n\\t/Users/huangmeng/go/src/github.com/hslam/tmp/log/main.go:27\\nruntime.main\\n\\t/usr/local/go/src/runtime/proc.go:250\"]\n```\n\n#### Highlight\n\u003cimg src=\"https://raw.githubusercontent.com/hslam/log/master/example.png\" width = \"828\" height = \"127\" alt=\"example\" align=center\u003e\n\n### License\nThis package is licensed under a MIT license (Copyright (c) 2019 Meng Huang)\n\n### Author\nlog was written by Meng Huang.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Flog/lists"}