go-micro: github.com/micro/go-micro/debug/log Index | Files | Directories

package log

import "github.com/micro/go-micro/debug/log"

Package log provides debug logging


Package Files

log.go options.go


var (
    // Default buffer size if any
    DefaultSize = 256
    // Default formatter
    DefaultFormat = TextFormat

func JSONFormat Uses

func JSONFormat(r Record) string

JSONFormat is a json Format func

func TextFormat Uses

func TextFormat(r Record) string

TextFormat returns text format

type FormatFunc Uses

type FormatFunc func(Record) string

Format is a function which formats the output

type Log Uses

type Log interface {
    // Read reads log entries from the logger
    Read(...ReadOption) ([]Record, error)
    // Write writes records to log
    Write(Record) error
    // Stream log records
    Stream() (Stream, error)

Log is debug log interface for reading and writing logs

type Option Uses

type Option func(*Options)

Option used by the logger

func Format Uses

func Format(f FormatFunc) Option

func Name Uses

func Name(n string) Option

Name of the log

func Size Uses

func Size(s int) Option

Size sets the size of the ring buffer

type Options Uses

type Options struct {
    // Name of the log
    Name string
    // Size is the size of ring buffer
    Size int
    // Format specifies the output format
    Format FormatFunc

Options are logger options

func DefaultOptions Uses

func DefaultOptions() Options

DefaultOptions returns default options

type ReadOption Uses

type ReadOption func(*ReadOptions)

ReadOption used for reading the logs

func Count Uses

func Count(c int) ReadOption

Count sets the number of log records to return

func Since Uses

func Since(s time.Time) ReadOption

Since sets the time since which to return the log records

type ReadOptions Uses

type ReadOptions struct {
    // Since what time in past to return the logs
    Since time.Time
    // Count specifies number of logs to return
    Count int
    // Stream requests continuous log stream
    Stream bool

ReadOptions for querying the logs

type Record Uses

type Record struct {
    // Timestamp of logged event
    Timestamp time.Time `json:"timestamp"`
    // Metadata to enrich log record
    Metadata map[string]string `json:"metadata"`
    // Value contains log entry
    Message interface{} `json:"message"`

Record is log record entry

type Stream Uses

type Stream interface {
    Chan() <-chan Record
    Stop() error

Stream returns a log stream


kubernetesPackage kubernetes is a logger implementing (github.com/micro/go-micro/v3/debug/log).Log
memoryPackage memory provides an in memory log buffer

Package log imports 3 packages (graph) and is imported by 7 packages. Updated 2020-08-21. Refresh now. Tools for package owners.