logging

package module
v0.0.0-...-5450ace Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 9

README

go-colorful-logging

LinkedIn Twitter HitCount License

A simple Go library for colorful logging output.

WHY THIS PROJECT?

This project is a spin-off of my WebRTC Nuts and Bolts project's logging part. In the main project, a logging mechanism that supports different colored outputs and shows logger part name (e.g. APP, WS, DTLS, SRTP, etc...) was needed.

INSTALLATION

go get github.com/adalkiran/go-colorful-logging

EXAMPLE OUTPUT

An output screenshot from WebRTC Nuts and Bolts project, which the same logging system was applied on:

An output screenshot from WebRTC Nuts and Bolts

EXAMPLE

You can find example projects made using go-colorful-logging and Inventa at https://github.com/adalkiran/inventa-examples.

In this inventa-examples repo, there are multiple projects. The ones which are developed using Go, use go-colorful-logging library for logging.

LICENSE

go-colorful-logging is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Documentation

Index

Constants

View Source
const (
	ProtoAPP  = "APP"
	ProtoHTTP = "HTTP"
	ProtoWS   = "WS"
)

Variables

View Source
var (
	Freef    = freeLevel.Printf
	Descf    = descLevel.Printf
	Infof    = infoLevel.Printf
	Warningf = warningLevel.Printf
	Errorf   = errorLevel.Printf
)

Functions

func AddToBlacklist

func AddToBlacklist(searchFor string, replaceWith string)

func LineSpacer

func LineSpacer(lineCount int)

Types

type ColorFunc

type ColorFunc func(format string, v ...interface{}) string

type LoggerLevel

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

func NewLoggerLevel

func NewLoggerLevel(logLevelPrefix string, colorAttributes ...color.Attribute) *LoggerLevel

func (*LoggerLevel) Printf

func (l *LoggerLevel) Printf(protocolPrefix string, format string, v ...interface{})

Jump to

Keyboard shortcuts

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