Skip to content

DE-labtory/iLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iLogger

iLooger is logger library for DE-labtory project.
You don't need to set complicated logeer. Just Import this pckage and Write log.

Getting Started with iLogger

Installation

go get -u github.com/DE-labtory/iLogger
dep ensure

Usage

Basic example

package main

import "github.com/DE-labtory/iLogger"

func main() {
    iLogger.Infof(nil, "This is Info log")
    iLogger.Warnf(nil, "This is Warn log")

    iLogger.SetToDebug()    // Would you use Debug logger? You should set debug state.
    iLogger.Debugf(nil, "This is Debug log")

    iLogger.Errorf(nil, "This is Error log")
    iLogger.Fatalf(nil, "This is Fatal log")
    iLogger.Panicf(nil, "This is Panic log")
}

log-basic-example
There are 6 Level for log

  • Info
  • Warn
  • Debug
  • Error
  • Fatal
  • Panic

Make log file

package main

import "github.com/DE-labtory/iLogger"

func main() {
    iLogger.EnableFileLogger(true, "./mylog.log")

    iLogger.Infof(nil, "This is Info log")
    iLogger.Warnf(nil, "This is Warn log")
}

You can write log to certain file path by calling EnableFileLogger function.

Print formatted string

package main

import "github.com/DE-labtory/iLogger"

func main() {
    iLogger.Info(nil, "This is Info log")
    iLogger.Infof(nil, "This is Infof log. %s", "This can use variadic arguments")
}

info-infof-example
Funcfion named aftet 'f' is for variadic arguments.
You can call the others level named after 'f'.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages