The Simplest and worst logging library ever written

Related tags

gologger
Overview

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
Issues
  • Right

    Right "go fmt" for whole project and fix some redundant usages

    Right "go fmt" for whole project and fix some redundant usages

    opened by dink10 1
  • Level handler

    Level handler

    opened by sadlil 0
  • 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!

    enhancement 
    opened by sauercrowd 1
  • 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)

    opened by kevsersrca 0
Releases(v0)
Owner
Sadlil Rhythom
Site Reliability Engineer @google. | ex- @bookingcom, @grab, @appscode. | Loves - @golang, @grpc, @docker, @kubernetes
Sadlil Rhythom
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

Bob Ziuchkovski 26 Sep 16, 2019
Logur is an opinionated collection of logging best practices

Logur is an opinionated collection of logging best practices. Table of Contents Preface Features Installation Usage FAQ Why not just X logger? Why not

Logur 126 Jun 10, 2021
Golang logging library

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

Örjan Fors 1.7k Jun 15, 2021
Structured, pluggable logging for Go.

Logrus Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger. Logrus is in maintenance-mode. We wi

Simon Eskildsen 18k Jun 13, 2021
Logrus is a structured, pluggable logging for Go.

Logrus is a structured logger for Go (golang), completely API compatible with the standard library logger.

Simon Eskildsen 274 May 25, 2021
A simple logging interface for Go

A more minimal logging API for Go Before you consider this package, please read this blog post by the inimitable Dave Cheney. I really appreciate what

null 398 Jun 10, 2021
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

Francois Parquet 394 Jun 12, 2021
Logging, distilled

What is distillog? distillog aims to offer a minimalistic logging interface that also supports log levels. It takes the stdlib API and only slightly e

Akshay Moghe 27 Feb 4, 2021
Structured Logging Made Easy

Structured Logging Made Easy Features Dependency Free Simple and Clean Interface Consistent Writer IOWriter, io.Writer wrapper FileWriter, rotating &

phuslu 374 Jun 14, 2021
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

Go kit 36 Jun 8, 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 23 Apr 28, 2021
Fully asynchronous, structured, pluggable logging for Go.

logr Logr is a fully asynchronous, contextual logger for Go. It is very much inspired by Logrus but addresses two issues: Logr is fully asynchronous,

Mattermost 10 Jun 16, 2021
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 18, 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 16 Jun 11, 2021