Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dixonwille/wlog
A simple logging interface that supports cross-platform color and concurrency.
https://github.com/dixonwille/wlog
awesome-go cli golang golang-package logger
Last synced: about 1 month ago
JSON representation
A simple logging interface that supports cross-platform color and concurrency.
- Host: GitHub
- URL: https://github.com/dixonwille/wlog
- Owner: dixonwille
- License: mit
- Created: 2016-04-13T16:47:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-05T19:56:00.000Z (3 months ago)
- Last Synced: 2024-03-05T20:52:56.207Z (3 months ago)
- Topics: awesome-go, cli, golang, golang-package, logger
- Language: Go
- Homepage:
- Size: 122 KB
- Stars: 64
- Watchers: 6
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Lists
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-extra - wlog - platform color and concurrency.|57|6|0|2016-04-13T16:47:40Z|2021-08-31T17:23:26Z| (Build Automation / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- fucking-awesome-go - :octocat: wlog - A simple logging interface that supports cross-platform color and concurrency. :star: 3 :fork_and_knife: 0 (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-projects - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - platform color and concurrency. | - | - | - | (Command Line / Standard CLI)
- awesome-go-with-framework - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-cn - wlog
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-stars - wlog(stars: 64) - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - 支持跨平台颜色和并发性的简单日志记录界面。 (<span id="命令行-command-line">命令行 Command Line</span> / 标准CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go. - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-cn - wlog - 简单的登录接口,支持跨平台颜色和并发 (命令行 / 标准命令行交互)
- awesome-go-with-stars - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-Char - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - A simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-cn - wlog - platform color and concurrency.) (命令行 / Standard CLI)
- repo-1316-awesome-go-cn - wlog
- repo-1211-awesome-go-cn - wlog
- awesome-reader - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - 簡單的登錄接口,支持跨平台顏色和並發 (命令行 / 標準命令行交互)
- Go-awesome - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-cn - wlog
- awesome-go-handwritten - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- my-stars - dixonwille/wlog - A simple logging interface that supports cross-platform color and concurrency. (Go)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go2 - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. - :arrow_down:5 - :star:5 (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - A simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go-cn - wlog
- awesome-go-zh - wlog
- awesome-go-cn - wlog
- go-awesome-cn-star - wlog
- awesome-go - wlog - A simple logging interface that supports cross-platform color and concurrency. - ★ 26 (Command Line)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard CLI)
- awesome-go - wlog - Simple logging interface that supports cross-platform color and concurrency. (Command Line / Standard 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)
Package wlog creates simple to use UI structure. The UI is used to simply print
to the screen. There a wrappers that will wrap each other to create a good
looking UI. You can add color and prefixes as well as make it thread safe.## Documentation
https://pkg.go.dev/github.com/dixonwille/wlog/v3
## Installation
WLog can be added to your go module file by running:
```bash
go get github.com/dixonwille/wlog/v3@latest
```You can them import the library using an import statement:
```go
import "github.com/dixonwille/wlog/v3"
```## Idea Behind WLog
I used Mitchellh's [CLI](https://github.com/mitchellh/cli) structure and
wrapping for the different structures. It was a clean look and feel. Plus it
was pretty simple to use. But I didn't want all the other cli stuff that came
with the package so I created this.For color I use DavidDenGCN's
[Go-ColorText](https://github.com/daviddengcn/go-colortext). His color package
allows for color that is available cross-platforms. I made a wrapper with all
possible color combinations with his package. So you only have to import this
package (one less line).## Example Usage
This 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.
```go
var ui wlog.UI
reader := strings.NewReader("User Input\r\n") //Simulate user typing "User Input" then pressing [enter] when reading from os.Stdin
ui = wlog.New(reader, os.Stdout, os.Stdout)
ui = wlog.AddPrefix("?", wlog.Cross, " ", "", "", "~", wlog.Check, "!", ui)
ui = wlog.AddConcurrent(ui)ui.Ask("Ask question", "")
ui.Error("Error message")
ui.Info("Info message")
ui.Output("Output message")
ui.Running("Running message")
ui.Success("Success message")
ui.Warn("Warning message")
```Output:
```
? Ask question
✗ Error message
Info message
Output message
~ Running message
✓ Success message
! Warning message
```On Windows it outputs to this (this includes color):
![winss](https://raw.githubusercontent.com/dixonwille/wlog/master/resources/winss.png)
On Mac it outputs to this (this includes color):
![macss](https://raw.githubusercontent.com/dixonwille/wlog/master/resources/macss.png)