Documentation ¶
Index ¶
- Variables
- func GetErrors(ctx Context) errcode.Errors
- func GetInstanceID(ctx Context) string
- func GetRequest(ctx Context) (*http.Request, error)
- func GetRequestID(ctx Context) string
- func GetRequestQueryParameters(ctx Context) url.Values
- func GetResponseWriter(ctx Context) (http.ResponseWriter, error)
- func GetStringValue(ctx Context, key interface{}) string
- func GetVersion(ctx Context) string
- func RemoteAddr(r *http.Request) string
- func RemoteIP(r *http.Request) string
- func Since(ctx Context, key interface{}) time.Duration
- func WithValues(ctx context.Context, vals map[string]interface{}) context.Context
- type Context
- func AppendError(ctx Context, err error) Context
- func Background() Context
- func WithErrors(ctx Context, errors errcode.Errors) Context
- func WithLogger(ctx Context, logger Logger) Context
- func WithRequest(ctx Context, r *http.Request) Context
- func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter)
- func WithValue(parent Context, key interface{}, val interface{}) Context
- func WithVars(ctx Context, r *http.Request) Context
- func WithVersion(ctx Context, version string) Context
- type Logger
- func GetLogger(ctx Context, keys ...interface{}) Logger
- func GetLoggerWithField(ctx Context, key, value interface{}, keys ...interface{}) Logger
- func GetLoggerWithFields(ctx Context, fields map[interface{}]interface{}, keys ...interface{}) Logger
- func GetRequestLogger(ctx Context) Logger
- func GetResponseLogger(ctx Context) Logger
- type Manager
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRequestContext = errors.New("no http request in context") ErrNoResponseWriterContext = errors.New("no http response in context") )
View Source
var DefaultContextManager = NewManager()
Functions ¶
func GetInstanceID ¶
func GetRequestID ¶
func GetResponseWriter ¶
func GetResponseWriter(ctx Context) (http.ResponseWriter, error)
func GetStringValue ¶
func GetVersion ¶
func RemoteAddr ¶
Types ¶
type Context ¶
func AppendError ¶
func Background ¶
func Background() Context
func WithLogger ¶
func WithResponseWriter ¶
func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter)
func WithVersion ¶
type Logger ¶
type Logger interface { Print(args ...interface{}) Printf(format string, args ...interface{}) Println(args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Fatalln(args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) Panicln(args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Debugln(args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Errorln(args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Infoln(args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Warnln(args ...interface{}) }
func GetLoggerWithField ¶
func GetLoggerWithFields ¶
func GetRequestLogger ¶
func GetResponseLogger ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.