nats-logr: Index | Files

package natslogr

import ""


Package Files

helper.go lib.go logger.go


const (
    Subject     = "cluster_subject"
    ClusterID   = "cluster_id"
    ClientID    = "client_id"
    NatsURL     = "nats_url"
    ConnectWait = "connect_wait"

Constants for Nats Streaming Server connection


var Stats struct {
    Info, Warning, Error OutputStats

Stats tracks the number of lines of output and number of bytes per severity level. Values must be read with atomic.LoadInt64.

func Flush Uses

func Flush()

Flush flushes all pending log I/O.

func InitFlags Uses

func InitFlags(flagset *flag.FlagSet)

InitFlags is for explicitly initializing the flags

func NewLogger Uses

func NewLogger(opts Options) logr.Logger

NewLogger returns a logr.Logger which is implemented by nats-logr

type Level Uses

type Level int32

Level specifies a level of verbosity for V logs. *Level implements flag.Value; the -v flag is of type Level and should be modified only through the flag.Value interface.

func (*Level) Get Uses

func (l *Level) Get() interface{}

Get is part of the flag.Value interface.

func (*Level) Set Uses

func (l *Level) Set(value string) error

Set is part of the flag.Value interface.

func (*Level) String Uses

func (l *Level) String() string

String is part of the flag.Value interface.

type Options Uses

type Options struct {
    ClusterID, ClientID, NatsURL, Subject string

The Options contains necessary information about nats-connection

type OutputStats Uses

type OutputStats struct {
    // contains filtered or unexported fields

OutputStats tracks the number of output lines and bytes written.

func (*OutputStats) Bytes Uses

func (s *OutputStats) Bytes() int64

Bytes returns the number of bytes written.

func (*OutputStats) Lines Uses

func (s *OutputStats) Lines() int64

Lines returns the number of lines written.

type Verbose Uses

type Verbose bool

Verbose is a boolean type that implements Infof (like Printf) etc. See the documentation of V for more information.

func V Uses

func V(level Level) Verbose

V reports whether verbosity at the call site is at least the requested level. The returned value is a boolean of type Verbose, which implements Info, Infoln and Infof. These methods will write to the Info log if called. Thus, one may write either

if natslog.V(2) { natslog.Info("log this") }


natslog.V(2).Info("log this")

The second form is shorter but the first is cheaper if logging is off because it does not evaluate its arguments.

Whether an individual call to V generates a log record depends on the setting of the -v and --vmodule flags; both are off by default. If the level in the call to V is at least the value of -v, or of -vmodule for the source file containing the call, the V call will log.

Package natslogr imports 17 packages (graph) and is imported by 4 packages. Updated 2019-07-10. Refresh now. Tools for package owners.