{"id":13413330,"url":"https://github.com/alexcesaro/log","last_synced_at":"2025-03-22T06:31:04.971Z","repository":{"id":16196185,"uuid":"18942887","full_name":"alexcesaro/log","owner":"alexcesaro","description":"Logging packages for Go","archived":false,"fork":false,"pushed_at":"2015-09-15T22:13:22.000Z","size":244,"stargazers_count":48,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-18T08:53:35.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"PolymerLabs/polylint","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexcesaro.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-04-19T14:31:56.000Z","updated_at":"2024-11-14T11:17:57.000Z","dependencies_parsed_at":"2022-09-11T16:10:44.665Z","dependency_job_id":null,"html_url":"https://github.com/alexcesaro/log","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcesaro%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcesaro%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcesaro%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcesaro%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexcesaro","download_url":"https://codeload.github.com/alexcesaro/log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244918500,"owners_count":20531682,"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":[],"created_at":"2024-07-30T20:01:37.915Z","updated_at":"2025-03-22T06:31:04.473Z","avatar_url":"https://github.com/alexcesaro.png","language":"Go","funding_links":[],"categories":["Relational Databases","Logging","日志记录","\u003cspan id=\"日志-logging\"\u003e日志 Logging\u003c/span\u003e","Logging 日志库","日志","日誌"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","SQL 查询语句构建库","高级控制台界面","高級控制台界面","Middlewares","交流"],"readme":"This repository contains logging packages for Go:\n - [stdlog](#stdlog) is the main package of this repository, it is a simple and\n   fast logger to the standard output.\n - [buflog](#buflog) and [golog](#golog) are customizable logging class which\n   can be used as a standalone or as a building block for other loggers.\n   [stdlog](#stdlog) is built upon them.\n - [log](#log) just provides a common interface for logging libraries.\n\nYou are more than welcome to ask questions on the [Go mailing-list](https://groups.google.com/d/topic/golang-nuts/Gif79T-1jNQ/discussion) and open issues here if you find bugs.\n\n\n# stdlog\n\n[Documentation](http://godoc.org/github.com/alexcesaro/log/stdlog)\n\nPackage stdlog provides simple and fast logging to the standard output\n(stdout) and is optimized for programs launched via a shell or cron. It can\nalso be used to log to a file by redirecting the standard output to a file.\nThis package is thread-safe.\n\nBasic examples:\n\n    logger := stdlog.GetFromFlags()\n    logger.Info(\"Connecting to the server...\")\n    logger.Errorf(\"Connection failed: %q\", err)\n\nWill output:\n\n    2014-04-02 18:09:15.862 INFO Connecting to the API...\n    2014-04-02 18:10:14.347 ERROR Connection failed (Server is unavailable).\n\nLog*() functions can be used to avoid evaluating arguments when it is\nexpensive and unnecessary:\n\n    logger.Debug(\"Memory usage: %s\", getMemoryUsage())\n    if LogDebug() { logger.Debug(\"Memory usage: %s\", getMemoryUsage()) }\n\nIf debug logging is off the getMemoryUsage() will be executed on the first\nline while it will not be executed on the second line.\n\nList of command-line arguments:\n\n    -log=info\n        Log events at or above this level are logged.\n    -stderr=false\n        Logs are written to standard error (stderr) instead of standard\n        output.\n    -flushlog=none\n        Until this level is reached nothing is output and logs are stored\n        in the memory. Once a log event is at or above this level, it\n        outputs all logs in memory as well as the future log events. This\n        feature should not be used with long-running processes.\n\nThe available levels are the eight ones described in RFC 5424 (debug,\ninfo, notice, warning, error, critical, alert, emergency) and none.\n\nSome use cases:\n   - By default, all logs except debug ones are output to the stdout. Which\n     is useful to follow the execution of a program launched via a shell.\n   - A program launched by a crontab where the variable `MAILTO` is set\n     with `-debug -flushlog=error` will send all logs generated by the\n     program only if an error happens. When there is no error the email\n     will not be sent.\n   - `my_program \u003e /var/log/my_program/my_program-$(date+%Y-%m-%d-%H%M%S).log`\n     will create a log file in /var/log/my_program each time it is run.\n\n\n# buflog\n\n[Documentation](http://godoc.org/github.com/alexcesaro/log/buflog)\n\nPackage buflog provides a buffered logging class that accumulates logs in\nmemory until the flush threshold is reached which release stored logs, the\nbuffered logger then act as a normal logger.\n\nBasic example:\n\n    logger := buflog.New(os.Stdout, log.Info, log.Error)\n    logger.Info(\"Connecting to the server...\")   // Outputs nothing\n    logger.Error(\"Connection failed\")            // Outputs both lines\n\n\n# golog\n\n[Documentation](http://godoc.org/github.com/alexcesaro/log/golog)\n\nPackage golog provides a customizable logging class which can be used as a\nstandalone or as a building block for other loggers.\n\nBasic example:\n\n    logger := golog.New(os.Stdout, log.Info)\n    logger.Info(\"Connecting to the server...\")\n    logger.Errorf(\"Connection failed: %q\", err)\n\nWill output:\n\n    2014-04-02 18:09:15.862 INFO Connecting to the API...\n    2014-04-02 18:10:14.347 ERROR Connection failed (Server is unavailable).\n\nLog*() functions can be used to avoid evaluating arguments when it is\nexpensive and unnecessary:\n\n    logger.Debug(\"Memory usage: %s\", getMemoryUsage())\n    if logger.LogDebug() { logger.Debug(\"Memory usage: %s\", getMemoryUsage()) }\n\nIf debug logging is off getMemoryUsage() will be executed on the first line\nwhile it will not be executed on the second line.\n\n\n# log\n\n[Documentation](http://godoc.org/github.com/alexcesaro/log)\n\nPackage log provides a common interface for logging libraries.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexcesaro%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexcesaro%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexcesaro%2Flog/lists"}