Go-logger - A sample go module that I stood up quickly to learn how remote modules work in go

go-logger

A sample go module that I stood up quickly to learn how remote modules work in go.

Installing this module

From inside a go project,

  1. run go get github.com/evenstephenr/go-logger@core
  2. you should see the dependency in your go.mod file

Using this module

There are generic error levels that this logger can report - Error, Info, Warn.

All generic errors generate strings with the error level prefixed.

func Error(message string) string {
	return ("ERROR: " + message)
}

func Info(message string) string {
	return ("INFO: " + message)
}

func Warn(message string) string {
	return ("WARN: " + message)
}

You can log these strings to the terminal yourself or use the built-in reporter.

package main

import (
  "fmt"

  "github.com/evenstephenr/go-logger"
)

func main() {
  fmt.PrintLn(logger.Info("inside some function block..."))
  logger.Report(logger.Info("inside some function block..."))
}

There's a separate reporter that can log a map of string metadata inline.

package main

import (
  "fmt"

  "github.com/evenstephenr/go-logger"
)

func main() {
  logger.ReportContext(logger.Debug("inside some function block"), map[string]string {
    "timestamp": time.Now().String()
	})
}

Debug logs

The Debug error is a special error in this module. Debug errors will not be reported unless you add a -d or -debug flag to a go package invocation. If you are using your own reporter, the Debug function returns an empty string when the package runtime does not include a debug flag. Neat.

// $USERPROFILE/go/hello
package main

import (
  "fmt"
  
  "github.com/evenstephenr/go-logger"
)

func main() {
  fmt.PrintLn("Hello")
  logger.Report(logger.Debug("Hello Debug!")
  
}
$ go run .
Hello

$ go run . -d
Hello
Hello Debug!
Owner
Stephen Ramirez
JS/TS fan, coffee connoisseur, OSS enthusiast
Stephen Ramirez
Similar Resources

A 12-factor app logger built for performance and happy development

A 12-factor app logger built for performance and happy development

logxi log XI is a structured 12-factor app logger built for speed and happy development. Simpler. Sane no-configuration defaults out of the box. Faste

Nov 27, 2022

Dead simple, super fast, zero allocation and modular logger for Golang

Onelog Onelog is a dead simple but very efficient JSON logger. It is one of the fastest JSON logger out there. Also, it is one of the logger with the

Sep 26, 2022

A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.

A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.

SQLDB-Logger A logger for Go SQL database driver without modify existing *sql.DB stdlib usage. Colored console writer output above only for sample/dev

Jan 3, 2023

xlog is a logger for net/context aware HTTP applications

xlog is a logger for net/context aware HTTP applications

⚠️ Check zerolog, the successor of xlog. HTTP Handler Logger xlog is a logger for net/context aware HTTP applications. Unlike most loggers, xlog will

Sep 26, 2022

Zero Allocation JSON Logger

Zero Allocation JSON Logger

Zero Allocation JSON Logger The zerolog package provides a fast and simple logger dedicated to JSON output. Zerolog's API is designed to provide both

Jan 1, 2023

A powerful zero-dependency json logger.

ZKits Logger Library About This package is a library of ZKits project. This is a zero-dependency standard JSON log library that supports structured JS

Dec 14, 2022

Configurable Logger for Go

Timber! This is a logger implementation that supports multiple log levels, multiple output destinations with configurable formats and levels for each.

Jun 28, 2022

A feature-rich and easy to use logger for golang

A feature-rich and easy to use logger for golang

A feature-rich and easy to use logger for golang 🚀 Install 🌲 Common Logs lumber.Success() lumber.Info() lumber.Debug() lumber.Warning()

Dec 31, 2022

A minimal and extensible structured logger

⚠️ PRE-RELEASE ⚠️ DO NOT IMPORT THIS MODULE YOUR PROJECT WILL BREAK package log package log provides a minimal interface for structured logging in ser

Jan 7, 2023
Logger - Simple logger without written with std pkg

Go-Logger Simple usage is: package main

Jan 2, 2022
Logger - A thin wrapper of uber-go/zap logger for personal project

a thin wraper of uber-go/zap logger for personal project 0. thanks uber-go/zap B

Sep 17, 2022
common logger utility module in go

Log & Go This is common logging utility tht is implemented only just for fun :) I will be giving the details about how to use this utility to log ever

Jan 5, 2022
A reusable logger module for basic logging, written in Go
A reusable logger module for basic logging, written in Go

logger A reusable logger module for basic logging, written in Go. Usage Client p

Jan 8, 2022
A project that adds color to golang's logger module

logger A project that adds color to golang's log module Installation go get github.com/christopher18/logger Usage // Import the module import "github

Dec 28, 2021
Sand is the next, versatile, high-level compiled or interpreted language that's easy to learn and performant to run.

Sand is the newest, dynamically typed, interpreted programming language. Table of Contents History Project Stats History Sand was created as part of @

Mar 13, 2022
Go-logging-logrus - Learn how to log management in golang with logrus

Learn how to logging in golang with logrus How to run this project git clone htt

Jan 19, 2022
A logger, for Go

Go-Log A logger, for Go! It's sort of log and code.google.com/p/log4go compatible, so in most cases can be used without any code changes. Breaking cha

Oct 7, 2022
Simple logger for Go programs. Allows custom formats for messages.
Simple logger for Go programs. Allows custom formats for messages.

go-logger A simple go logger for easy logging in your programs. Allows setting custom format for messages. Preview Install go get github.com/apsdehal/

Dec 17, 2022
Loggly Hooks for GO Logrus logger

Loggly Hooks for Logrus Usage package main import ( "github.com/sirupsen/logrus" "github.com/sebest/logrusly" ) var logglyToken string = "YOUR_LOG

Sep 26, 2022