A tiny debug logging tool. Ideal for CLI tools and command applications

Overview

kemba

License: MIT Go Report Card Coverage Status go.dev reference Mentioned in Awesome Go

debug logging tool inspired by https://github.com/visionmedia/debug

Why is it named kemba?

debug is more generally considered to be runtime/debug within Go. Since this takes heavy inspiration from my experiences using the npm module debug I wanted to find a word that was somewhat connected to the inspiration. According to Google translate "debug" in English translated to Icelandic results in "kemba".

Usage

The kemba logger reads the DEBUG and KEMBA environment variables to determine if a log line should be output. The logger outputs to STDERR.

When it is not set, the logger will immediately return, taking no action.

When the value is set (ex. DEBUG=example:*,tool:details and/or KEMBA=plugin:fxn:start), the logger will determine if it should be enabled when instantiated.

The value of these flags can be a simple regex alternative where a wildcard (*) are replaced with .* and all terms are prepended with ^ and appended with $. If a term does not include a wildcard, then an exact match it required.

To disabled colors, set the NOCOLOR environment variable to any value.

image

package main

import (
    "time"

	"github.com/clok/kemba"
)

type myType struct {
	a, b int
}

// When the DEBUG or KEMBA environment variable is set to DEBUG=example:* the kemba logger will output to STDERR
func main () {
    k := kemba.New("example:tag")
	
    var x = []myType{
    	{1, 2},
    	{3, 4},
    }
    k.Printf("%#v", x)
    // Output to os.Stderr
    // example:tag []main.myType{main.myType{a:1, b:2}, main.myType{a:3, b:4}} +0s

    // Artificial delay to demonstrate the time tagging
    time.Sleep(250 * time.Millisecond)
    k.Printf("%# v", x)
    k.Println(x)

    // Artificial delay to demonstrate the time tagging
    time.Sleep(100 * time.Millisecond)
    k.Log(x)
    // All result in the same output to os.Stderr
    // example:tag []main.myType{ +XXms
    // example:tag     {a:1, b:2},
    // example:tag     {a:3, b:4},
    // example:tag }

    // Create a new logger with an extended tag
    k1 := k.Extend("1")
    k1.Println("a string", 12, true)
    // Output to os.Stderr
    // example:tag:1 a string +0s
    // example:tag:1 int(12)
    // example:tag:1 bool(true)
}

Development

  1. Fork the clok/kemba repo
  2. Use go >= 1.16
  3. Branch & Code
  4. Run linters 🧹 golangci-lint run
  5. Commit with a Conventional Commit
  6. Open a PR
Issues
  • chore(deps): update actions/setup-go action to v2

    chore(deps): update actions/setup-go action to v2

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/setup-go | action | major | v1 -> v2 |


    Release Notes

    actions/setup-go

    v2

    Compare Source


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies major 
    opened by renovate[bot] 1
  • chore(deps): update all non-major dependencies

    chore(deps): update all non-major dependencies

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | coverallsapp/github-action | action | patch | v1.1.2 -> 1.1.3 | | github.com/gookit/color | require | minor | v1.4.2 -> v1.5.0 | | github.com/kr/pretty | require | minor | v0.2.1 -> v0.3.0 |


    Release Notes

    coverallsapp/github-action

    v1.1.3

    Compare Source

    Added:

    • feat: add addition override parameters (@​mad-it)

    Security improvements:

    • Dependabot PRs
    gookit/color

    v1.5.0

    Compare Source

    Change Log

    Update
    • update: add case for tests WSL env https://github.com/gookit/color/commit/44058898ccb9660cd713cee033472eb2d8603580
    • Add bg colors to basic to hex convertor https://github.com/gookit/color/commit/ac28629353f8d8558feb83bead17d478daf4e5e1
    • add new project on readme https://github.com/gookit/color/commit/254c63f8abccd86c0201c814590c7afcbad8e76a
    • up: add more unit tests https://github.com/gookit/color/commit/5f87df48555ce0dac5a2981638dc3e9d43b1e969
    • enhance: support use color name create some common rgb color https://github.com/gookit/color/commit/e48d1e5803a8f30335c91fb6a3c9cdb565d79977
    • breaking: will not support go < 1.13 https://github.com/gookit/color/commit/b29d2b20b8e2f830de919ba29795b87677c36e50
    Feature
    • feat: support create Rgb color from Hsl value, issue #​40 https://github.com/gookit/color/commit/dfe4c47c2703da71535ceda22798bd2da869c012
    • feat: add more convert methods on Color https://github.com/gookit/color/commit/3986cfdc2218045802bec480b0c36b6e6ed5bdc3
    Other
    • readme: update readme add more projects https://github.com/gookit/color/commit/ce88fcee7c22dc3dc59e6d5e64558ca03e09ce48
    • readme: update readme https://github.com/gookit/color/commit/79357dc20edd6a400b1620d99f8302d781f74364
    • chore: add an example demo for use color https://github.com/gookit/color/commit/c8097c233b23c3cc1102dfe0e28b247f2c8eee06
    • Bump github.com/stretchr/testify from 1.3.0 to 1.7.0 https://github.com/gookit/color/commit/468b81a7f6a8257456704b11294cfa272f0b1779
    • style: add some comments https://github.com/gookit/color/commit/d1c276a856b99bd7279ba94e23aa2d3d46f9fa85
    • sytle: update readme https://github.com/gookit/color/commit/c7dc09464b28518c2ae383fa16b989e7c0169599
    kr/pretty

    v0.3.0

    Compare Source


    Configuration

    📅 Schedule: At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 1
  • fix(deps): update module github.com/gookit/color to v1.4.2

    fix(deps): update module github.com/gookit/color to v1.4.2

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/gookit/color | require | minor | v1.3.8 -> v1.4.2 |


    Release Notes

    gookit/color

    v1.4.2

    Compare Source

    v1.4.1

    Compare Source

    v1.4.0

    Compare Source


    Configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box.

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • fix(deps): update module github.com/gookit/color to v1.3.8 - autoclosed

    fix(deps): update module github.com/gookit/color to v1.3.8 - autoclosed

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/gookit/color | require | patch | v1.3.6 -> v1.3.8 |


    Release Notes

    gookit/color

    v1.3.8

    Compare Source

    v1.3.7

    Compare Source


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [x] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • fix(deps): update module gookit/color to v1.3.7 - autoclosed

    fix(deps): update module gookit/color to v1.3.7 - autoclosed

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | gookit/color | require | patch | v1.3.6 -> v1.3.7 |


    Release Notes

    gookit/color

    v1.3.7

    Compare Source


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • chore(deps): update module gookit/color to v1.3.7 - autoclosed

    chore(deps): update module gookit/color to v1.3.7 - autoclosed

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/gookit/color | require | patch | v1.3.6 -> v1.3.7 |


    Release Notes

    gookit/color

    v1.3.7

    Compare Source


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • chore(deps): update module stretchr/testify to v1.7.0

    chore(deps): update module stretchr/testify to v1.7.0

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/stretchr/testify | require | minor | v1.6.1 -> v1.7.0 |


    Release Notes

    stretchr/testify

    v1.7.0

    Compare Source

    Minor feature improvements and bug fixes


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • chore(deps): update module gookit/color to v1.3.6

    chore(deps): update module gookit/color to v1.3.6

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/gookit/color | require | patch | v1.3.2 -> v1.3.6 |


    Release Notes

    gookit/color

    v1.3.6

    Compare Source

    v1.3.5

    Compare Source

    v1.3.4

    Compare Source

    v1.3.3

    Compare Source

    • feat: add func (RGBColor) C16() Color

    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • chore(deps): update jandelgado/gcov2lcov-action action to v1.0.8

    chore(deps): update jandelgado/gcov2lcov-action action to v1.0.8

    WhiteSource Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | jandelgado/gcov2lcov-action | action | patch | v1.0.7 -> v1.0.8 |


    Release Notes

    jandelgado/gcov2lcov-action

    v1.0.8

    Compare Source

    Fix download problem when specific gcov2lcov version is used (#​12 )


    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • chore(deps): update module gookit/color to v1.3.2

    chore(deps): update module gookit/color to v1.3.2

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/gookit/color | require | patch | v1.3.1 -> v1.3.2 |


    Release Notes

    gookit/color

    v1.3.2

    Compare Source

    Release v1.3.2

    • support add color options for 256, rgb colors

    Renovate configuration

    :date: Schedule: At any time (no schedule defined).

    :vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

    :recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    :no_bell: Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by WhiteSource Renovate. View repository job log here.

    dependencies minor 
    opened by renovate[bot] 1
  • Dependency Dashboard

    Dependency Dashboard

    This issue provides visibility into Renovate updates and their statuses. Learn more

    This repository currently has no open or pending branches.


    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Releases(v1.1.1)
Owner
Derek Smith
Husband, father, engineer. Passionate about the craft, quality and Open-Source.
Derek Smith
FactorLog is a logging infrastructure for Go that provides numerous logging functions for whatever your style may be

FactorLog FactorLog is a fast logging infrastructure for Go that provides numerous logging functions for whatever your style may be. It could easily b

Kevin Darlington 54 Oct 12, 2021
Package logging implements a logging infrastructure for Go

Golang logging library Package logging implements a logging infrastructure for Go. Its output format is customizable and supports different logging ba

Luke Zhang 0 Nov 10, 2021
Very simple charts with some debug data for Go programs

debugcharts Go memory debug charts. This package uses Plotly chart library. It is open source and free for use. Installation go get -v -u github.com/m

Marko Kevac 464 Jan 21, 2022
Peimports - based on golang's debug/pe this package gives quick access to the ordered imports of pe files with ordinal support

This code is almost entirely derived from the Go standard library's debug/pe package. It didn't provide access to ordinal based entries in the IAT and

Mike Wiacek 0 Jan 5, 2022
Request-logging-tool - A tool logs the md5 codes of the responses of the given domains in parameter

request-logging-tool Application to send http requests and log the md5 responses

Kushan Pandipperuma 1 Jan 7, 2022
SigNoz helps developer monitor applications and troubleshoot problems in their deployed applications

SigNoz helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc. ?? ??

SigNoz 5.6k Jan 20, 2022
Simple and configurable Logging in Go, with level, formatters and writers

go-log Logging package similar to log4j for the Golang. Support dynamic log level Support customized formatter TextFormatter JSONFormatter Support mul

Guoqiang Chen 11 Feb 21, 2021
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets.

ozzo-log Other languages 简体中文 Русский Description ozzo-log is a Go package providing enhanced logging support for Go programs. It has the following fe

Ozzo Framework 118 Jan 11, 2022
Shikhandi: a tiny load generator for opentelemetry and heavily

shikhandi is a tiny load generator for opentelemetry and heavily inspired by thi

Srikanth Chekuri 1 Dec 21, 2021
Simple and blazing fast lockfree logging library for golang

glg is simple golang logging library Requirement Go 1.11 Installation go get github.com/kpango/glg Example package main import ( "net/http" "time"

Yusuke Kato 136 Jan 3, 2022
The Simplest and worst logging library ever written

gologger A Simple Easy to use go logger library. Displays Colored log into console in any unix or windows platform. You can even store your logs in fi

Sadlil Rhythom 39 Jan 19, 2021
Simple, configurable and scalable Structured Logging for Go.

log Log is a simple, highly configurable, Structured Logging library Why another logging library? There's allot of great stuff out there, but also tho

Go Playgound 276 Nov 15, 2021
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting.

Seelog Seelog is a powerful and easy-to-learn logging framework that provides functionality for flexible dispatching, filtering, and formatting log me

Seelog project repository 1.6k Jan 12, 2022
Hierarchical, leveled, and structured logging library for Go

spacelog Please see http://godoc.org/github.com/spacemonkeygo/spacelog for info License Copyright (C) 2014 Space Monkey, Inc. Licensed under the Apach

Space Monkey Go 98 Apr 27, 2021
Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.

Noodlog Summary Noodlog is a Golang JSON parametrized and highly configurable logging library. It allows you to: print go structs as JSON messages; pr

Gyoza Tech 35 Dec 29, 2021
Simple, customizable, leveled and efficient logging in Go

log Simple, customizable, leveled and efficient logging in Go Installation go get -u github.com/ermanimer/log Features log is a simple logging package

Erman İmer 21 Dec 20, 2021
An example logging system using Prometheus, Loki, and Grafana.

Logging Example Structure Collector Export numerical data for Prometheus and log data for Promtail. Exporter uses port 8080 Log files are saved to ./c

YoungHwan Joo 1 Dec 6, 2021
This package enables json output, level logging and so on to standard go logger.

logplug This package enables json output, level logging and so on to standard logger. Usage log.SetOutput(logplug.NewJSONPlug(os.Stderr, logplug.LogF

Koumei Mikuni 0 Dec 27, 2021
gtl - Gemini Tiny Logs - A simple TUI for the tinylog format on gemini

GTL: Gemini Tiny Logs Goal: A TUI for the tinylogs format on the gemini space. See screenshots Installation gtl requires go ≥ 1.16 From Source git clo

bacardi55 15 Dec 5, 2021