Skip to content

djmarrerajr/common-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proprietary Tenders - Gift Cards

Common Library



Table of Contents:



A very simple, albeit contrived, example:


package main

import (
	"github.com/djmarrerajr/common-lib/errs"
	"github.com/djmarrerajr/common-lib/utils"
)

func main() {
	logger := utils.NewLogger("INFO")

	err := validate()
	if err != nil {
		logger.Error("startup failed", err)
	}
}

func validate() error {
	return errs.New(errs.ErrTypeValidation, "validation failed")
}

... and the output:

$ go run main.go 2>&1 | jq

{
  "level": "error",
  "ts": 1683114890.155433,
  "caller": "main.go:13",
  "msg": "startup failed",
  "error.message": "validation failed",
  "stacktrace": "main.main\n\t/main.go:13\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages