espipe: github.com/khezen/espipe/log Index | Files

package log

import "github.com/khezen/espipe/log"

Index

Package Files

client.go level.go logger.go message.go

Constants

const (
    // WebCallMessage is the default message for WebCallLogs
    WebCallMessage = "http-call-trace"
)

type Config Uses

type Config struct {
    Service  string
    Endpoint string
}

Config contains end point for a service

type Level Uses

type Level string

Level defines the severity of the log message

const (
    // LevelVerbose defines the "Verbose" log level/severity
    LevelVerbose Level = "Verbose"
    // LevelInfo defines the "Information" log level/severity
    LevelInfo Level = "Information"
    // LevelWarning defines the "Warning" log level/severity
    LevelWarning Level = "Warning"
    // LevelError defines the "Error" log level/severity
    LevelError Level = "Error"
    // LevelFatal defines the "Fatal" log level/severity
    LevelFatal Level = "Fatal"
)

type Logger Uses

type Logger interface {
    Message(lvl Level, rid, msg string)
    WebCall(rid, cip, host, path, method, reqBody string, statCode int, resBody string, sec float64)
}

Logger defines the Peaks services generic logging interface

func NewLogger Uses

func NewLogger(config Config) Logger

NewLogger creates new espipe logger

type Message Uses

type Message struct {
    Level     Level  `json:"level"`
    Service   string `json:"service"`
    RequestID string `json:"request_id"`
    Message   string `json:"message"`
}

Message is a basic representation of a log

type WebCall Uses

type WebCall struct {
    Level             Level   `json:"level"`
    Service           string  `json:"service"`
    Message           string  `json:"message"`
    RequestID         string  `json:"request_id"`
    ClientIP          string  `json:"client_ip"`
    Host              string  `json:"host"`
    Path              string  `json:"path"`
    Method            string  `json:"method"`
    Request           string  `json:"request"`
    StatusCode        int     `json:"status_code"`
    Response          string  `json:"response"`
    ResponseInSeconds float64 `json:"response_in_seconds"`
}

WebCall is http call trace ready to be logged

Package log imports 6 packages (graph). Updated 2018-08-31. Refresh now. Tools for package owners.