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 file, ElasticSearch or MySQL Database.

Developed:

- Colored and Simple Log into Console
- File Logging
- ElasticSearch Logging

How to Get:

$ go get github.com/sadlil/gologger

How To Use:

import "github.com/sadlil/gologger"

Console::
logger = gologger.GetLogger(gologger.CONSOLE, gologger.SimpleLog)
// Displays Simple plain log in console

logger = gologger.GetLogger(gologger.CONSOLE, gologger.ColoredLog)
// Displays Colorful log in console


File::
logger = gologger.GetLogger(gologger.FILE, fileName)
// Log all the message in the given file.
// If file is not presents then creates it. if filename is "" creates
// a default file named logs.txt in ur project directory.


ElasticSearch::
logger = gologger.GetLogger(gologger.ELASTICSEARCH, location)
// Logs everything into elasticsearch. if location is "" then it
// looks for elasticsearch by default in http://localhost:9200
// and logs stored in index 'gologger'.
// If you want to provide custom location and index for your log
// you must provide the location in this format
// "http://Your_ES_Url:ES_Port/Index",
// If you only want to change the default index name you can do that
// by sending "/YourIndex", it will use default localhost for ES.

Display:

logger.Log(Message) -> displays in console.
[Log] [Time] [Package Name::File Name::Function Name] [Line Number] Message

Logger Functions Available:

logger.Log(message string)
logger.Message(message string)
logger.Info(message string)
logger.Warn(message string)
logger.Debug(message string)
logger.Error(message string)

You can use two or more same type or diffrent type logger in same application.

logger1 = gologger.GetLogger(gologger.CONSOLE, gologger.SimpleLog)
logger2 = gologger.GetLogger(gologger.FILE, "filelog.log")

logger1.log("Hello Console") // loges into console.
logger2.log("Hello File") // loges into file.

Any suggestion and Issue would be highly appreciated. You can create an issue or pull request if you think i need to modify my library.

Used Libraries

  1. Color Console - faith/color
  2. ElasticSearch - olivere/elastic
Owner
Sadlil Rhythom
Site Reliability Engineer @google. | ex- @bookingcom, @grab, @appscode. | Loves - @golang, @grpc, @docker, @kubernetes
Sadlil Rhythom
Similar Resources

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

Apr 27, 2021

Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.

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

Oct 27, 2022

Logging library for Golang

GLO Logging library for Golang Inspired by Monolog for PHP, severity levels are identical Install go get github.com/lajosbencz/glo Severity levels Deb

Sep 26, 2022

Minimalistic logging library for Go.

Minimalistic logging library for Go.

logger Minimalistic logging library for Go. Blog Post Features: Advanced output filters (package and/or level) Attributes Timers for measuring perform

Nov 16, 2022

A pure Go contextual logging library with "batteries included"

Cue Overview Cue implements contextual logging with "batteries included". It has thorough test coverage and supports logging to stdout/stderr, file, s

Sep 16, 2019

Golang logging library

Golang logging library

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

Dec 27, 2022

Minimal structured logging library for Go

Minimal structured logging library for Go

slog slog is a minimal structured logging library for Go. Install go get cdr.dev/slog Features Minimal API First class context.Context support First c

Dec 29, 2022

Cloud logging library in golang

🔥 logg Open Source Cloud logging library in Go. About the project Connect your golang microservices logs with this engine! Send your logs to kafka, r

Nov 8, 2021

Logging library for Leadjet backend services

Logger Logging library for Leadjet backend services. Install go get -u github.com/Leadjet/logger Usage Initiate a Zap logger; err := zap.RegisterLog(

Feb 21, 2022
Comments
  • Feature: logger.Add(otherLogger)

    Feature: logger.Add(otherLogger)

    Hi!

    I really like the simplicity of your library. A small thought/idea:

    It might be helpful if it is possible to add a logger to another one, to only use one logging statement to write to both targets, i.e.:

    logger1 = gologger.GetLogger(gologger.CONSOLE, gologger.SimpleLog)
    logger1.Add(gologger.GetLogger(gologger.FILE, "filelog.log"))
    
    logger1.log("Hello Console") // logs into console and file.
    

    Just wanted to put this up for discussion, would love to hear your opinion on this!

  • Log file limit

    Log file limit

    I did not see a solution about the log file size. For example max bytes for python logging package

    RotatingFileHandler(filename, maxBytes=10*1024*1024, backupCount=5)

Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

gomol Gomol (Go Multi-Output Logger) is an MIT-licensed structured logging library for Go. Gomol grew from a desire to have a structured logging libra

Sep 26, 2022
A simple logging module for go, with a rotating file feature and console logging.

A simple logging module for go, with a rotating file feature and console logging. Installation go get github.com/jbrodriguez/mlog Usage Sample usage W

Dec 14, 2022
FactorLog is a logging infrastructure for Go that provides numerous logging functions for whatever your style may be
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

Aug 3, 2022
Package logging implements a logging infrastructure for Go
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

Nov 10, 2021
GoVector is a vector clock logging library written in Go.
GoVector is a vector clock logging library written in Go.

GoVector is a vector clock logging library written in Go. The vector clock algorithm is used to order events in distributed systems in the absence of a centralized clock. GoVector implements the vector clock algorithm and provides feature-rich logging and encoding infrastructure.

Nov 28, 2022
a lightweight, high-performance, out-of-the-box logging library that relies solely on the Go standard library

English | 中文 olog olog is a lightweight, high-performance, out-of-the-box logging library that relies solely on the Go standard library. Support outpu

Apr 12, 2023
LogVoyage - logging SaaS written in GoLang
LogVoyage - logging SaaS written in GoLang

No longer maintained, sorry. Completely rewritten v2 is going to be released soon. Please follow http://github.com/logvoyage LogVoyage - fast and simp

Sep 26, 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
Simple and blazing fast lockfree logging library for golang
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"

Nov 28, 2022
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

Jan 3, 2023