Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 2.46 KB

README.md

File metadata and controls

84 lines (54 loc) · 2.46 KB

Crylog

Summary


Using Crylog for Golang you can add log entries with different severety in your golang project. You can define log entries for ERROR, COMMUNICATE, REPORT, INFO, WARN and DEBUG. After you enriched your golang project with advanced log entries, you can put a config file next to your main.go file, where you can specify the loglevel you want to enable. It will follow the direction described above, so if you chose Info inside your config file it will print out Error, Communicate, Report and Info. Each level will be printed in a specific color to the log, so you are able to differentiate them visually. You can set the loglevel per package.

Set Up

Download the project

go get https://github.com/svenschaper/crylog

Import the package into your go File

import "github.com/svenschaper/crylog"

How to use?

Create a config.yml and put it next to your main.go file

log.level: DEBUG                        //Default log level for all packages
log.level.yourPackageName: INFO         //Specific log level for the package yourPackageName
log.level.main: ERROR                   //Specific log level for the package main

Add the following to your go files

var logger logging.Logger

func init() {
	logger = logging.GeneralInitLogger("yourPackageName")
}


func yourFunction(){
    logger.Info("This is a green info message")
	logger.Error("This is a red error message")
	logger.Debug("This is a blue debug message")
	logger.Warn("This is a purple warn message")
	logger.Report("This is a cyan report message")
    logger.Communicate("This is yellow communication message")
    

	logger.InfoWithC("This is a green info message", "This part of the message should be encrypted")
}





Need custom development?

Cloud Computing

  • Infrastructure automation based on ansible
  • Custom solutions based on AWS
  • Custom solutions based on Google Cloud
  • Custom solutions based on Azure Cloud

Integration

  • API Management and Design
  • Lightning fast Microservices based on Golang

License

MIT licensed. In short -> Have fun with it!