{"id":17614705,"url":"https://github.com/joefitzgerald/streamlog","last_synced_at":"2025-03-30T00:40:31.054Z","repository":{"id":19546949,"uuid":"22795363","full_name":"joefitzgerald/streamlog","owner":"joefitzgerald","description":"A Go (golang) Logger For Standard Output Streams","archived":false,"fork":false,"pushed_at":"2014-08-11T21:07:33.000Z","size":192,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T02:38:47.870Z","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/joefitzgerald.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-08-09T21:15:57.000Z","updated_at":"2023-09-08T16:49:41.000Z","dependencies_parsed_at":"2022-08-24T03:30:59.524Z","dependency_job_id":null,"html_url":"https://github.com/joefitzgerald/streamlog","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/joefitzgerald%2Fstreamlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fstreamlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fstreamlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joefitzgerald%2Fstreamlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joefitzgerald","download_url":"https://codeload.github.com/joefitzgerald/streamlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246262492,"owners_count":20749170,"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-22T18:44:27.554Z","updated_at":"2025-03-30T00:40:31.035Z","avatar_url":"https://github.com/joefitzgerald.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamlog\n\n[![wercker status](https://app.wercker.com/status/3c161febd57a5afe98400a45214b02d2/m \"wercker status\")](https://app.wercker.com/project/bykey/3c161febd57a5afe98400a45214b02d2)\n\n## Overview\n\nThe go standard library includes a default\n[log.Logger](http://golang.org/pkg/log/#Logger) that targets `stderr`. Sometimes\nwhen writing a command line interface (CLI), the output to `stderr` and `stdout`\nis significant and you want to write tests to verify the output is correct.\n\n## Differences With The Standard Library `log.Logger`\n\n`streamlog.Logger` drops the `Fatal`, `Fatalf`, `Fatalln`, `Panic`, `Panicf`,\nand `Panicln` methods from `log.Logger`, and modifies the `Print`, `Printf`, and\n`Println` methods to include a `streamlog.OutputStream` argument (`streamlog.Out`\nand `streamlog.Err` are possible values). It also adds `PrintOut`, `PrintfOut`,\n`PrintlnOut`, `PrintErr`, `PrintfErr`, and `PrintlnErr` methods.\n\nA `streamlog.Logger` is included that internally has an `out` and an\n`err` `log.Logger`.\n\n* `streamlog.New()`: Provides you a `Logger` targeting `os.Stdout` and `os.Stderr`\n  with a prefix of `\"\"` and flags of `log.LstdFlags`\n* `streamlog.NewWithWriters(...)`: Provides you a `Logger` targeting the supplied\n  out and err `io.Writer`, prefix, and flags\n* `streamlog.NewWithWriters(...)`: Provides you a `Logger` targeting the supplied\n  out and err `standardlog.Logger`, prefix, and flags\n\nNote: `standardlog.Logger` is satisfied by the standard library `log.Logger`.\n\n`streamlog.NewWithWriters` provides an easy way to write tests to verify your\nlog output. `streamlog.NewWithLoggers` provides an easy way to completely change\nthe behavior of the logging.\n\n## Usage\n\n`go get -u github.com/joefitzgerald/streamlog`\n\n```go\npackage main\n\nimport \"github.com/joefitzgerald/streamlog\"\n\nfunc main() {\n  l := streamlog.New()\n  l.SetPrefix(\"\") // You can set the prefix of the underlying log.Loggers\n  l.SetFlags(0)   // You can set the flags of the underlying log.Loggers\n  l.Println(streamlog.Out, \"Hello\")\n  l.PrintlnOut(\"World\")\n  l.Println(streamlog.Err, \"Earth\")\n  l.PrintlnErr(\"#%!!\")\n  logStuffOut(l, \"$\")\n}\n\nfunc logStuffOut(l streamlog.Logger, s string) {\n  l.Println(streamlog.Out, s)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoefitzgerald%2Fstreamlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoefitzgerald%2Fstreamlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoefitzgerald%2Fstreamlog/lists"}