{"id":36813015,"url":"https://github.com/hemantjadon/barrel","last_synced_at":"2026-01-12T13:51:01.950Z","repository":{"id":57541999,"uuid":"292487052","full_name":"hemantjadon/barrel","owner":"hemantjadon","description":"Rolling writer which can be used when underlying writer changes.","archived":false,"fork":false,"pushed_at":"2021-01-25T08:30:33.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T14:24:40.386Z","etag":null,"topics":["golang","logging","writer"],"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/hemantjadon.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":"2020-09-03T06:34:18.000Z","updated_at":"2021-01-25T08:30:35.000Z","dependencies_parsed_at":"2022-09-08T23:51:26.771Z","dependency_job_id":null,"html_url":"https://github.com/hemantjadon/barrel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hemantjadon/barrel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemantjadon%2Fbarrel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemantjadon%2Fbarrel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemantjadon%2Fbarrel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemantjadon%2Fbarrel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hemantjadon","download_url":"https://codeload.github.com/hemantjadon/barrel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemantjadon%2Fbarrel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28339582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","logging","writer"],"created_at":"2026-01-12T13:51:01.847Z","updated_at":"2026-01-12T13:51:01.925Z","avatar_url":"https://github.com/hemantjadon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# barrel\n\n![Go](https://github.com/hemantjadon/barrel/workflows/barrel/badge.svg?branch=master\u0026event=push)\n\n`barrel` provides a rolling writer which can be used as an `io.Writer` when\nthe underlying writer may change.\n\n## Usage\n\n`barrel` can be used at any place where some changing `io.Writer` is needed.\n\n### Files\n\n`barrel` can be used with package `barrel/barrelfile` to write rolling files, \nwhere the underlying file vary according to some trigger.\n\n```go\nfile, _ := os.OpenFile(\"/path/to/file\", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)\n\nrollingWriter := barrel.RollingWriter{\n    Writer: file,\n    Trigger: barrelfile.TriggerAdapter{\n        FileTrigger: barrelfile.SizeBasedTrigger{Size: 1 * 1e3 * 1e3}, // 1 MB\n    },\n    Rotator: barrelfile.RotatorAdapter{\n        FileRotator: barrelfile.TransformRotator{\n            Transformers: []barrelfile.Transformer{\n                barrelfile.RenameTransformer{\n                    Namer: barrelfile.TimestampSequenceNamer{},\n                },\n                barrelfile.GzipTransformer{\n                    GzipLevel: gzip.DefaultCompression,\n                },\n            },\n            Rotator: barrelfile.IdentityRotator{},\n        },\n        OpenFlag: os.O_WRONLY | os.O_CREATE | os.O_APPEND,\n    },\n}\n\n_, _ = rollingWriter.Write([]byte(\"hello world\"))\ndefer func() { _ = rollingWriter.Close() }()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemantjadon%2Fbarrel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhemantjadon%2Fbarrel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemantjadon%2Fbarrel/lists"}