cblog

package
v0.0.0-...-9c72d28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2020 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

README

cb-log

CB-Log is the logger library for the Cloud-Barista Multi-Cloud Framework.

1. install CB-Log library pkg

A. $ go get github.com/cloud-barista/cb-log

2. example

A. https://github.com/cloud-barista/cb-log/blob/master/test/sample.go

3. test example

A. $ cd test

B. $ go run sample.go

  …
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:25, main.main() - start.........
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:45, main.createUser1() - start creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:59, main.createUser1() - finish creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:64, main.createUser2() - start creating user.
  [CB-SPIDER].[ERROR]: 2019-08-16 23:22:51 sample.go:69, main.createUser2() - DBMS Session is closed!!
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:78, main.createUser2() - finish creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:51 sample.go:37, main.main() - end.........

  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:25, main.main() - start.........
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:45, main.createUser1() - start creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:59, main.createUser1() - finish creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:64, main.createUser2() - start creating user.
  [CB-SPIDER].[ERROR]: 2019-08-16 23:22:53 sample.go:69, main.createUser2() - DBMS Session is closed!!
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:78, main.createUser2() - finish creating user.
  [CB-SPIDER].[INFO]: 2019-08-16 23:22:53 sample.go:37, main.main() - end.........
  …

C. set Log Level: info => error
i. $ vi ../conf/config.yaml

  …
  [CB-SPIDER].[ERROR]: 2019-08-16 23:22:57 sample.go:69, main.createUser2() - DBMS Session is closed!!

  [CB-SPIDER].[ERROR]: 2019-08-16 23:22:59 sample.go:69, main.createUser2() - DBMS Session is closed!!
  …

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigString

func GetConfigString(configInfos *CBLOGCONFIG) string

func GetLevel

func GetLevel() string

func GetLogger

func GetLogger(loggerName string) *logrus.Logger

You can set up with Framework Name, a Framework Name is one of loggerName.

func SetLevel

func SetLevel(strLevel string)

Types

type CBLOGCONFIG

type CBLOGCONFIG struct {
	CBLOG struct {
		LOOPCHECK bool
		LOGLEVEL  string
		LOGFILE   bool
	}

	LOGFILEINFO struct {
		FILENAME   string
		MAXSIZE    int
		MAXBACKUPS int
		MAXAGE     int
	}
}

func GetConfigInfos

func GetConfigInfos() CBLOGCONFIG

type CBLogger

type CBLogger struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL