{"id":13724106,"url":"https://github.com/facebookarchive/flog","last_synced_at":"2025-05-07T17:32:58.899Z","repository":{"id":57580571,"uuid":"174052899","full_name":"facebookarchive/flog","owner":"facebookarchive","description":"A Go library for logging","archived":true,"fork":false,"pushed_at":"2019-09-30T13:28:31.000Z","size":26,"stargazers_count":79,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-04T01:23:46.965Z","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":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookarchive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-06T02:05:49.000Z","updated_at":"2023-01-28T11:39:53.000Z","dependencies_parsed_at":"2022-09-26T19:13:43.149Z","dependency_job_id":null,"html_url":"https://github.com/facebookarchive/flog","commit_stats":null,"previous_names":["facebookincubator/flog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fflog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fflog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fflog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fflog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookarchive","download_url":"https://codeload.github.com/facebookarchive/flog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224628371,"owners_count":17343330,"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-08-03T01:01:50.311Z","updated_at":"2025-05-07T17:32:58.875Z","avatar_url":"https://github.com/facebookarchive.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# flog\n[![Build Status](https://travis-ci.org/facebookincubator/flog.svg?branch=master)](https://travis-ci.org/facebookincubator/flog)\n[![GoDoc](https://godoc.org/github.com/facebookincubator/flog?status.svg)](https://godoc.org/github.com/facebookincubator/flog)\n\nFlog is a hacked and slashed version of glog that can be used as a drop in\nreplacement for the latter.\n\n## Overview\nFlog was originally created to facilitate logging from within libraries but can be used in main programs as well.\n\nTo this end, this library has some significant differences, compared to the\noriginal glog. Namely:\n\n* It only logs to stderr. Logging to files, along with all relevant flags and\ntests has been removed.\n* It supports configuration through env vars as well as a configuration struct\nthat allows for more flexibility when using the lib.\n* Users can log immediately without first having to call flag.Parse().\n* It only adds flags for the lib explicitly.\n* It has a different buffer allocation mechanism that works faster in scenarios\nwhere parallel logging is required (see the BenchmarkHeaderParallel).\n* Support to get the current verbosity level.\n* Support to set a different output writer.\n* Two more severity levels added, DEBUG and CRITICAL, along with their relevant\nDebug*() and Critical*() functions.\n\nHowever, the important parts of glog have been retained, such as:\n\n* The V() functionality remains the same.\n* Users can use Info*(), Warning*(), Error*() and Fatal*() functions as before.\n* Filtering through module name and tracebacks are supported in exactly the\nsame way as in glog.\n\n## Configuration\n\nAs noted above configuration is possible through different ways. We outline them\nbelow.\n\n### Environment Variables\n\nflog supports 3 different env vars for configuring its behavior. These are:\n\n* FLOG_VERBOSITY - takes an int \u003e 0 argument and will set the overall Verbosity\nfor the lib.\n* FLOG_VMODULE - takes a string argument containing a pattern which is then used\nto filter logs from different module thus allowing to setup different\nverbosities for different parts of the program.\n* FLOG_LOG_BACKTRACE_AT - takes a string argument so that when logging from a\nparticular line in a particular file a stack trace is also printed.\n\nThese vars are considered during package initialization through its init()\nfunction.\n\n### CLI flags\n\nAs with the original glog, flog also supports adding flags that configure the\nbehavior described above. The flags are -v, -vmodule and -log_backtrace_at and\ntheir meaning is equivalent to the env vars described above.\nUnlike glog however, these flags are added only after an explicit call to the\nAddFlags() function of the package and only support the flag Go package. This\ncall will add all flags to a given flag set. The second argument is a config\nstructure (cf. Section 2.3) which, if not nil, will have its Set() method called\nbefore setting any flags. This function returns either any errors produced by\nSet() or nil.\n\n### The Config structure\n\nThis is a flexible interface that we've added to allow programs to create more\ncomplex logging configurations where parts of the program may log with different\nverbosities and can request different filters.\n\nThe struct contains the following members, Verbosity, Vmodule and TraceLocation\nand their meaning is the same as the flags described above. All the members of\nthis struct are strings.\nThe caller must call the Set() method of this struct to set the values. This\nmethod is concurrency-safe.\n\n### Precedence\n\nThe order by which this lib honors the above configuration options is:\n\n1. Environment Variables\n2. Flags\n3. Any values set through Config objects\n\n### Defaults\n\nThe default values are as follows:\n\n* Verbosity = 0\n* Vmodule = \"\"\n* Log Backtrace At = \"\"\n\n## License\nFlog is published under the Apache v2.0 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Fflog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookarchive%2Fflog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Fflog/lists"}