{"id":18915194,"url":"https://github.com/uber-common/bark","last_synced_at":"2025-08-21T08:31:34.172Z","repository":{"id":36668686,"uuid":"40975057","full_name":"uber-common/bark","owner":"uber-common","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-12T19:59:01.000Z","size":61,"stargazers_count":49,"open_issues_count":0,"forks_count":4,"subscribers_count":2275,"default_branch":"master","last_synced_at":"2024-12-10T08:42:29.587Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber-common.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":"2015-08-18T13:56:30.000Z","updated_at":"2024-04-02T09:23:08.000Z","dependencies_parsed_at":"2022-09-06T11:41:22.025Z","dependency_job_id":null,"html_url":"https://github.com/uber-common/bark","commit_stats":null,"previous_names":["uber/bark"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber-common%2Fbark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber-common%2Fbark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber-common%2Fbark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber-common%2Fbark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber-common","download_url":"https://codeload.github.com/uber-common/bark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230501172,"owners_count":18236061,"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-11-08T10:14:48.913Z","updated_at":"2024-12-19T21:10:27.761Z","avatar_url":"https://github.com/uber-common.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Synopsis  [![Build Status](https://travis-ci.org/uber-common/bark.svg?branch=master)](https://travis-ci.org/uber-common/bark)\n\nDefines an interface for loggers and stats reporters that can be passed to Uber Go libraries.  \nProvides implementations which wrap a common logging module, [logrus](https://github.com/sirupsen/logrus), \nand a common stats reporting module [go-statsd-client](https://github.com/cactus/go-statsd-client).  \nClients may also choose to implement these interfaces themselves.\n\n## Key Interfaces\n\n### Logging\n\n```go\n// Logger is an interface for loggers accepted by Uber's libraries.\ntype Logger interface {\n\t// Log at debug level\n\tDebug(args ...interface{})\n\n\t// Log at debug level with fmt.Printf-like formatting\n\tDebugf(format string, args ...interface{})\n\n\t// Log at info level\n\tInfo(args ...interface{})\n\n\t// Log at info level with fmt.Printf-like formatting\n\tInfof(format string, args ...interface{})\n\n\t// Log at warning level\n\tWarn(args ...interface{})\n\n\t// Log at warning level with fmt.Printf-like formatting\n\tWarnf(format string, args ...interface{})\n\n\t// Log at error level\n\tError(args ...interface{})\n\n\t// Log at error level with fmt.Printf-like formatting\n\tErrorf(format string, args ...interface{})\n\n\t// Log at fatal level, then terminate process (irrecoverable)\n\tFatal(args ...interface{})\n\n\t// Log at fatal level with fmt.Printf-like formatting, then terminate process (irrecoverable)\n\tFatalf(format string, args ...interface{})\n\n\t// Log at panic level, then panic (recoverable)\n\tPanic(args ...interface{})\n\n\t// Log at panic level with fmt.Printf-like formatting, then panic (recoverable)\n\tPanicf(format string, args ...interface{})\n\n\t// Return a logger with the specified key-value pair set, to be logged in a subsequent normal logging call\n\tWithField(key string, value interface{}) Logger\n\n\t// Return a logger with the specified key-value pairs set, to be  included in a subsequent normal logging call\n\tWithFields(keyValues LogFields) Logger\n\n\t// Return map fields associated with this logger, if any (i.e. if this logger was returned from WithField[s])\n\t// If no fields are set, returns nil\n\tFields() Fields\n}\n```\n\n### Stats Reporting\n\n```go\n// StatsReporter is an interface for statsd-like stats reporters accepted by Uber's libraries.\n// Its methods take optional tag dictionaries which may be ignored by concrete implementations.\ntype StatsReporter interface {\n\t// Increment a statsd-like counter with optional tags\n\tIncCounter(name string, tags Tags, value int64)\n\n\t// Increment a statsd-like gauge (\"set\" of the value) with optional tags\n\tUpdateGauge(name string, tags Tags, value int64)\n\n\t// Record a statsd-like timer with optional tags\n\tRecordTimer(name string, tags Tags, d time.Duration)\n}\n```\n\n## Basic Usage\n\n```go\nlogger := logrus.New()\nbarkLogger := bark.NewLoggerFromLogrus(logger)\nbarkLogger.WithFields(bark.Fields{\"someField\":\"someValue\"}).Info(\"Message\")\n\nstatsd, err := statsd.New(\"127.0.0.1:8125\", \"barktest\")\nif err != nil {\n    logger.Fatal(\"Example code failed\")\n}\n\nbarkStatsReporter := bark.NewStatsReporterFromCactus(statsd)  \nbarkStatsReporter.IncCounter(\"foo\", map[string]string{\"tag\":\"val\"}, 1)\n \nubermodule.New(ubermodule.Config{\n    logger: barkLogger\n    statsd: barkStatsReporter\n})\n```\n\n## Contributors\n\ndh\n\n## License\n\nbark is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber-common%2Fbark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber-common%2Fbark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber-common%2Fbark/lists"}