wincolog

package module
v0.0.0-...-3411d0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2015 License: MIT Imports: 4 Imported by: 2

README

Windows color support for CoLog

Uses go-colorable to display unix terminal colors on Windows. Behaviour for other systems is not altered.

wincolog demo

package main

import (
	"log"

	"comail.io/go/colog"
	"comail.io/go/wincolog"
)

func main() {
	colog.Register()
	colog.SetOutput(wincolog.Stdout())
	log.Println("trace: Trace should be plain")
	log.Println("debug: Debug should be blue")
	log.Println("info: Info should be green")
	log.Println("warn: Warning should be yellow")
	log.Println("error: Error should be red")
	log.Println("alert: Alert should be white on re")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stderr

func Stderr() io.Writer

Stderr returns a WinColorTerminal when stderr is a windows terminal returns the built-in os.Stderr otherwise

func Stdout

func Stdout() io.Writer

Stdout returns a WinColorTerminal when stdout is a windows terminal returns the built-in os.Stdout otherwise

Types

type WinColorTerminal

type WinColorTerminal struct {
	// contains filtered or unexported fields
}

WinColorTerminal wraps a colorable Writer with a ColorSupporter interface

func (*WinColorTerminal) ColorSupported

func (w *WinColorTerminal) ColorSupported() bool

ColorSupported implements the ColorSupporter interface

func (*WinColorTerminal) Write

func (w *WinColorTerminal) Write(p []byte) (n int, err error)

Write implements the io.Writer interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL