{"id":16516230,"url":"https://github.com/aphistic/golf","last_synced_at":"2025-08-07T09:20:08.452Z","repository":{"id":57479302,"uuid":"41273700","full_name":"aphistic/golf","owner":"aphistic","description":"Client library written in Go for sending messages to Graylog Extended Log Format (GELF) servers. Allows per-message and global attributes to be attached to messages.","archived":false,"fork":false,"pushed_at":"2018-07-12T15:58:19.000Z","size":21,"stargazers_count":8,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T04:32:17.770Z","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/aphistic.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-24T00:45:41.000Z","updated_at":"2025-02-11T21:32:04.000Z","dependencies_parsed_at":"2022-09-18T05:45:16.810Z","dependency_job_id":null,"html_url":"https://github.com/aphistic/golf","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/aphistic%2Fgolf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphistic%2Fgolf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphistic%2Fgolf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aphistic%2Fgolf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aphistic","download_url":"https://codeload.github.com/aphistic/golf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244124198,"owners_count":20401685,"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-10-11T16:20:11.051Z","updated_at":"2025-03-21T08:31:47.300Z","avatar_url":"https://github.com/aphistic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"golf\n====\n\n[![GoDoc](https://godoc.org/github.com/aphistic/golf?status.svg)](https://godoc.org/github.com/aphistic/golf)\n[![Build Status](https://travis-ci.org/aphistic/golf.svg?branch=master)](https://travis-ci.org/aphistic/golf)\n[![codecov.io](http://codecov.io/github/aphistic/golf/coverage.svg?branch=master)](http://codecov.io/github/aphistic/golf?branch=master)\n\nGolf is an MIT-licensed Go client library for servers supporting the Graylog\nExtended Log Format (GELF, https://www.graylog.org/resources/gelf-2/).\n\nIf you run into any issues with the library or have any feature requests, please create issues for them!\n\nAs this library is very new, the API could still change.  I don't expect it to change much because I'm pretty happy with how it is now but if anyone has suggestions easier ways to use the library via API changes I would be open to it.\n\nTest coverage is an ongoing process!\n\nFeatures\n========\n\n* GELF 1.1 support\n* Native Go implementation\n* Supports Logger-level and Message-level attributes\n\nInstallation\n============\n\nThe recommended way to install is via http://gopkg.in\n\n    go get gopkg.in/aphistic/golf.v0\n    ...\n    import \"gopkg.in/aphistic/golf.v0\"\n\nGolf can also be installed the standard way as well\n\n    go get github.com/aphistic/golf\n    ...\n    import \"github.com/aphistic/golf\"\n\nExamples\n========\n\nFor brevity a lot of error checking has been omitted from these examples, be sure you do your checks!\n\nThe standard way to implement the golf library is by creating a Client, connecting to a server and creating Loggers off that Client:\n\n```go\npackage main\n\nimport (\n    \"gopkg.in/aphistic/golf.v0\"\n)\n\nfunc main() {\n    c, _ := golf.NewClient()\n    c.Dial(\"udp://192.168.30.150\")\n\n    l, _ := c.NewLogger()\n    // Attributes set at the Logger level will automatically be included\n    // on each message sent from that Logger.  This is helpful if there's\n    // any consistent information you don't want to include every time you\n    // log a message.\n    l.SetAttr(\"facility\", \"golf.example\")\n    l.SetAttr(\"instance_id\", 12345)\n\n    for idx := 1; idx \u003c= 10; idx++ {\n        l.Dbgm(map[string]interface{}{\n            \"msg_attr1\": 1234,\n        }, \"Test message %v\", idx)\n    }\n\n    c.Close()\n}\n```\n\nIt is also possible to set a Logger as the default for the golf library so you don't need to keep track of a main Logger manually:\n\n```go\npackage main\n\nimport (\n    \"gopkg.in/aphistic/golf.v0\"\n)\n\nfunc main() {\n    c, _ := golf.NewClient()\n    c.Dial(\"udp://192.168.30.150\")\n\n    l, _ := c.NewLogger()\n    // Set l as the default logger\n    golf.DefaultLogger(l)\n    // Attributes set at the Logger level will automatically be included\n    // on each message sent from that Logger.  This is helpful if there's\n    // any consistent information you don't want to include every time you\n    // log a message.\n    l.SetAttr(\"facility\", \"golf.example\")\n    l.SetAttr(\"instance_id\", 12345)\n\n    for idx := 1; idx \u003c= 10; idx++ {\n        // Use the default logger to send the message\n        golf.Dbgm(map[string]interface{}{\n            \"msg_attr1\": 1234,\n        }, \"Test message %v\", idx)\n    }\n\n    c.Close()\n}\n```\n\nYou can use the query parameter \"compress\" in the Dial URL, with one of the following value:\n\n* none\n* zlib\n* gzip\n\n```\nudp://192.168.30.150?compress=none\n```\n\nDefault is gzip compression.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faphistic%2Fgolf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faphistic%2Fgolf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faphistic%2Fgolf/lists"}