cb-log is a logger library for the Cloud-Barista Multi-Cloud Framework.
[NOTE]
cb-log is currently under development.
So, we do not recommend using the current release in production.
Please note that the functionalities of cb-log are not stable and secure yet.
If you have any difficulties in using cb-log, please let us know.
(Open an issue or Join the cloud-barista Slack)
$ cd $CBLOG_ROOT/test
$ vi $CBLOG_ROOT/conf/log_conf.yaml ## debug => error
$ go run sample.go # setup cb-log with a user defined configuration file in code
[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!!
$ cd ./test
$ go run sample-with-config-path.go # setup cb-log with a user defined configuration file in code
[CB-SPIDER ..\conf\log_conf.yaml]
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:27, main.main() - start.........
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:48, main.createUser3() - start creating user.
[CB-SPIDER].[DEBUG]: 2020-12-23 17:46:09 sample-with-config-path.go:58, main.createUser3() - msg for debugging msg!!
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:63, main.createUser3() - finish creating user.
[CB-SPIDER].[DEBUG]: 2020-12-23 17:46:09 sample-with-config-path.go:30, main.main() - msg for debugging msg!!
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:68, main.createUser4() - start creating user.
[CB-SPIDER].[ERROR]: 2020-12-23 17:46:09 sample-with-config-path.go:73, main.createUser4() - DBMS Session is closed!!
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:82, main.createUser4() - finish creating user.
[CB-SPIDER].[INFO]: 2020-12-23 17:46:09 sample-with-config-path.go:40, main.main() - end.........
Log Level 변경 및 실행 결과: debug => error
$ cd ./test
$ vi ../conf/log_conf.yaml ## debug => error
$ go run sample-with-config-path.go # setup cb-log with a user defined configuration file in code
[CB-SPIDER].[ERROR]: 2020-12-23 18:08:12 sample-with-config-path.go:73, main.createUser4() - DBMS Session is closed!!
[CB-SPIDER].[ERROR]: 2020-12-23 18:08:14 sample-with-config-path.go:73, main.createUser4() - DBMS Session is closed!!
Get the logger with name you set. The name will be used as below (name: CB-SPIDER)
[CB-SPIDER].[INFO]: 2020-12-24 16:54:46 sample-with-config-path.go:27, main.main() - start.........
Read configuration file (log_conf.yaml) by the path set on environment variable (e.g., $CBLOG_ROOT)