{"id":13413316,"url":"https://github.com/jbrodriguez/mlog","last_synced_at":"2025-08-04T12:13:25.334Z","repository":{"id":22140761,"uuid":"25471841","full_name":"jbrodriguez/mlog","owner":"jbrodriguez","description":"A simple logging module for go, with a rotating file feature and console logging.","archived":false,"fork":false,"pushed_at":"2018-08-05T17:35:46.000Z","size":12,"stargazers_count":33,"open_issues_count":2,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-02T16:57:15.145Z","etag":null,"topics":[],"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/jbrodriguez.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":"2014-10-20T15:06:26.000Z","updated_at":"2024-11-21T20:26:17.000Z","dependencies_parsed_at":"2022-08-20T22:10:45.168Z","dependency_job_id":null,"html_url":"https://github.com/jbrodriguez/mlog","commit_stats":null,"previous_names":["apertoire/mlog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jbrodriguez/mlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbrodriguez%2Fmlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbrodriguez%2Fmlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbrodriguez%2Fmlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbrodriguez%2Fmlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbrodriguez","download_url":"https://codeload.github.com/jbrodriguez/mlog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbrodriguez%2Fmlog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268695652,"owners_count":24292086,"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-04T02:00:09.867Z","response_time":79,"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":[],"created_at":"2024-07-30T20:01:37.543Z","updated_at":"2025-08-04T12:13:24.629Z","avatar_url":"https://github.com/jbrodriguez.png","language":"Go","funding_links":[],"categories":["Logging","\u003cspan id=\"日志-logging\"\u003e日志 Logging\u003c/span\u003e","日志记录","日志","Relational Databases","Logging 日志库","日誌"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","检索及分析资料库","高级控制台界面","SQL 查询语句构建库","高級控制台界面","交流"],"readme":"A simple logging module for go, with a rotating file feature and console logging.\n\n## Installation\ngo get github.com/jbrodriguez/mlog\n\n## Usage\nSample usage\n\nWrite to stdout/stderr and create a rotating logfile\n```go\npackage main\n\nimport \"github.com/jbrodriguez/mlog\"\n\nfunc main() {\n\tmlog.Start(mlog.LevelInfo, \"app.log\")\n\n\tmlog.Info(\"Hello World !\")\n\n\tipsum := \"ipsum\"\n\tmlog.Warning(\"Lorem %s\", ipsum)\n}\n```\n\nWrite to stdout/stderr only\n```go\npackage main\n\nimport \"github.com/jbrodriguez/mlog\"\n\nfunc main() {\n\tmlog.Start(mlog.LevelInfo, \"\")\n\n\tmlog.Info(\"Hello World !\")\n\n\tipsum := \"ipsum\"\n\tmlog.Warning(\"Lorem %s\", ipsum)\n}\n```\n\nBy default, the log will be rolled over to a backup file when its size reaches 10Mb and 10 such files will be created (and eventually reused).\n\nAlternatively, you can specify the max size of the log file before it gets rotated, and the number of backup files you want to create, with the StartEx function.\n\n```go\npackage main\n\nimport \"github.com/jbrodriguez/mlog\"\n\nfunc main() {\n    mlog.StartEx(mlog.LevelInfo, \"app.log\", 5*1024*1024, 5)\n\n    mlog.Info(\"Hello World !\")\n\n    ipsum := \"ipsum\"\n    mlog.Warning(\"Lorem %s\", ipsum)\n}\n```\nThis will rotate the file when it reaches 5Mb and 5 backup files will eventually be created.\n\nSetting logger flags:\n```go\nmlog.DefaultFlags = log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile\n```\n\n## Output\n\n```\nI: 2015/05/15 07:09:45 main.go:10: Hello World !\nW: 2015/05/15 07:09:45 main.go:13: Lorem ipsum\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbrodriguez%2Fmlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbrodriguez%2Fmlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbrodriguez%2Fmlog/lists"}