{"id":13410719,"url":"https://github.com/dixonwille/wlog","last_synced_at":"2025-04-05T18:09:45.964Z","repository":{"id":57485746,"uuid":"56169518","full_name":"dixonwille/wlog","owner":"dixonwille","description":"A simple logging interface that supports cross-platform color and concurrency.","archived":false,"fork":false,"pushed_at":"2024-11-25T10:51:50.000Z","size":130,"stargazers_count":66,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T17:11:15.763Z","etag":null,"topics":["awesome-go","cli","golang","golang-package","logger"],"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/dixonwille.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dixonwille"}},"created_at":"2016-04-13T16:47:40.000Z","updated_at":"2024-08-22T06:14:23.000Z","dependencies_parsed_at":"2022-09-11T16:01:34.810Z","dependency_job_id":"6715b065-5b87-47b6-8762-80775ecb1eab","html_url":"https://github.com/dixonwille/wlog","commit_stats":{"total_commits":66,"total_committers":7,"mean_commits":9.428571428571429,"dds":"0.48484848484848486","last_synced_commit":"a39fa152ff7a63ecaa19d9ae816560efb70921b6"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dixonwille%2Fwlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dixonwille%2Fwlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dixonwille%2Fwlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dixonwille%2Fwlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dixonwille","download_url":"https://codeload.github.com/dixonwille/wlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"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":["awesome-go","cli","golang","golang-package","logger"],"created_at":"2024-07-30T20:01:08.636Z","updated_at":"2025-04-05T18:09:45.934Z","avatar_url":"https://github.com/dixonwille.png","language":"Go","funding_links":["https://github.com/sponsors/dixonwille"],"categories":["Command Line","Go","Build Automation","命令行","命令行工具","命令行工具### 标准 CLI`用于创建一个标准命令行应用程序的库`","\u003cspan id=\"命令行-command-line\"\u003e命令行 Command Line\u003c/span\u003e"],"sub_categories":["Standard CLI","标准CLI","标准 CLI","标准命令行交互","標準命令行交互"],"readme":"# WLog[![Pull Requests](https://github.com/dixonwille/wlog/actions/workflows/pullRequests.yaml/badge.svg?event=push)](https://github.com/dixonwille/wlog/actions/workflows/pullRequests.yaml)\n\nPackage wlog creates simple to use UI structure. The UI is used to simply print\nto the screen. There a wrappers that will wrap each other to create a good\nlooking UI. You can add color and prefixes as well as make it thread safe.\n\n## Documentation\n\nhttps://pkg.go.dev/github.com/dixonwille/wlog/v3\n\n## Installation\n\nWLog can be added to your go module file by running:\n\n```bash\ngo get github.com/dixonwille/wlog/v3@latest\n```\n\nYou can them import the library using an import statement:\n\n```go\nimport \"github.com/dixonwille/wlog/v3\"\n```\n\n## Idea Behind WLog\n\nI used Mitchellh's [CLI](https://github.com/mitchellh/cli) structure and\nwrapping for the different structures. It was a clean look and feel. Plus it\nwas pretty simple to use. But I didn't want all the other cli stuff that came\nwith the package so I created this.\n\nFor color I use DavidDenGCN's\n[Go-ColorText](https://github.com/daviddengcn/go-colortext). His color package\nallows for color that is available cross-platforms. I made a wrapper with all\npossible color combinations with his package. So you only have to import this\npackage (one less line).\n\n## Example Usage\n\nThis example creates a new `wlog.UI` instance, simulates a user providing input and calls UI functions that show output. If you wish to try the example and provide your own user input you can replace the `reader` variable with a reader such as `os.Stdin` which will read from a terminal.\n\n```go\nvar ui wlog.UI\nreader := strings.NewReader(\"User Input\\r\\n\") //Simulate user typing \"User Input\" then pressing [enter] when reading from os.Stdin\nui = wlog.New(reader, os.Stdout, os.Stdout)\nui = wlog.AddPrefix(\"?\", wlog.Cross, \" \", \"\", \"\", \"~\", wlog.Check, \"!\", ui)\nui = wlog.AddConcurrent(ui)\n\nui.Ask(\"Ask question\", \"\")\nui.Error(\"Error message\")\nui.Info(\"Info message\")\nui.Output(\"Output message\")\nui.Running(\"Running message\")\nui.Success(\"Success message\")\nui.Warn(\"Warning message\")\n```\n\nOutput:\n\n```\n? Ask question\n✗ Error message\n Info message\nOutput message\n~ Running message\n✓ Success message\n! Warning message\n```\n\nOn Windows it outputs to this (this includes color):\n\n![winss](https://raw.githubusercontent.com/dixonwille/wlog/master/resources/winss.png)\n\nOn Mac it outputs to this (this includes color):\n\n![macss](https://raw.githubusercontent.com/dixonwille/wlog/master/resources/macss.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdixonwille%2Fwlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdixonwille%2Fwlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdixonwille%2Fwlog/lists"}