Categorygithub.com/ownercoder/goerrors
modulepackage
1.0.4
Repository: https://github.com/ownercoder/goerrors.git
Documentation: pkg.go.dev

# README

Logging entry point lib for Butik services

Fast start

  1. Select formatter:
       formatter := &TextFormatter{
         TextFormatter: logrus.TextFormatter{ForceColors: true, FullTimestamp: true},
       }
       // Or this:
       formatter := &JSONFormatter{}
    
  2. Initialize logging instance:
       goerrors.InitLog(goerrors.DebugLevel, formatter, nil)
    
  3. Use as logrus:
       goerrors.Log().Info("test")
    

For detailed usage see code examples and comments in goerrors_test.go

Levels

TRACE, DEBUG, INFO --> stdout

WARN, ERROR, FATAL, PANIC --> stderr + Sentry

Requests logging and recovery

The library provides middleware for GRPC and HTTP servers:

    r := mux.Router()
    r.Use(goerrors.HTTPLoggingHandler) // INFO-level short info for every incoming request
    r.Use(goerrors.HTTPRecoverer)
    grpcServer := grpc.NewServer(
        grpc.StreamInterceptor(GRPCStreamServerRecoverer()),
    	grpc.UnaryInterceptor(GRPCUnaryServerRecoverer()),
    )

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author