A simple logging interface that supports cross-platform color and concurrency.

WLog Build Status Go Report Card codecov

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

import "github.com/dixonwille/wlog/v3"

Idea Behind WLog

I used Mitchellh's 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. 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

var ui UI
reader := strings.NewReader("User Input\r\n") //Simulate user typing "User Input" then pressing [enter] when reading from os.Stdin
ui = New(reader, os.Stdout, os.Stdout)
ui = AddPrefix("?", Cross, " ", "", "", "~", Check, "!", ui)
ui = 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

On Mac it outputs to this (this includes color):

macss

Usage

Please use the Documentaion to read more into how to use this package.

Similar Resources

Advanced ANSI style & color support for your terminal applications

Advanced ANSI style & color support for your terminal applications

termenv lets you safely use advanced styling options on the terminal. It gathers information about the terminal environment in terms of its ANSI & col

Dec 31, 2022

A Go library for terminal background color detection

go-termbg A Go library for terminal background color detection. The detected color is provided by RGB or theme ( dark or light ). Based on https://git

Jan 4, 2022

Color quantization experiment for golang

bitcrush Color quantization experiment, version 4 Build git clone https://github

Jun 15, 2022

A CLI based Downloader utilising Golang's concurrency feature.

Downloader CLI based downloader utilising the concurrency feature of Golang. Takes the download URL of the file from the user. Splits the files into s

Nov 6, 2021

Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.

Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.

dasel Dasel (short for data-selector) allows you to query and modify data structures using selector strings. Comparable to jq / yq, but supports JSON,

Jan 2, 2023

A tiny command-line orientated PKM tool inspired by Taskwarrior and daily logging.

eden eden is a command line tool for creating and manipulating daily log notes. It started life as a series of different bash script that did various

Jan 20, 2022

A flexible commandline tool for template rendering. Supports lots of local and remote datasources.

A flexible commandline tool for template rendering. Supports lots of local and remote datasources.

Read the docs at docs.gomplate.ca, chat with developers and community in the #gomplate channel on Gophers Slack gomplate is a template renderer which

Jan 5, 2023

Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux.

Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux.

Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux. Features Change colors whole UI Inject CSS for advanced

Jan 2, 2023

Inotify-tools is a C library and a set of command-line programs providing a simple interface to inotify.

inotify-tools This is a package of some commandline utilities relating to inotify. The general purpose of this package is to allow inotify's features

Jan 4, 2023
Comments
  • https://github.com/dixonwille/wmenu/issues/9

    https://github.com/dixonwille/wmenu/issues/9

    WMenu has an issue with response not being trimmed.

    Need a way to trim the response not just by spaces but by whatever character is delimited. Maybe only allow you to trim by a certain character?

🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.

?? Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Dec 30, 2022
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!

F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely.

Dec 31, 2022
cross platform command line tool to list, notify and book vaccine using cowin API

Command line tool to List and Book Vaccine cowin-cli is a simple cli tool to book vaccines and list centers using the COWIN API. It also supports auto

Mar 7, 2022
🚤 Cross-platform, unofficial CLI for Cloudflare Warp

wgcf is an unofficial, cross-platform CLI for Cloudflare Warp

Jan 7, 2023
cross-platform, cli app to perform various operations on string
cross-platform, cli app to perform various operations on string

sttr is command line software that allows you to quickly run various transformation operations on the string.

Dec 30, 2022
🐘 Cross-platform, neofetch alternative for fetching system info.
 🐘 Cross-platform, neofetch alternative for fetching system info.

elefetch ?? Cross-platform, neofetch alternative for fetching system info. Installation go get: go get -u github.com/burntcarrot/elefetch Binaries Bin

Jan 23, 2022
ntest is a cross-platform cli app that runs multiple tests against any address.
ntest is a cross-platform cli app that runs multiple tests against any address.

ntest ntest is a cross-platform cli app that runs multiple tests against any address. About ntest Having the ability to run common tests against any d

Jan 3, 2022
Battery - cross-platform get battery status

battery Cross-platform get battery status. Tested on Arch Linux, Debian, Ubuntu, Windows, macOS. import "github.com/caiguanhao/battery" battery.GetSt

Dec 31, 2021
Color package for Go (golang)
Color package for Go (golang)

color Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in severa

Dec 31, 2022
Draw images in your ANSI terminal with true color
Draw images in your ANSI terminal with true color

___ _____ ____ / _ \/ _/ |/_/ /____ ______ _ Made with love by Eliuk Blau / ___// /_> </ __/ -_) __/ ' \ https://github.com/eliukblau/pix

Dec 14, 2022