logs

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 66

README

logs

Helper library required for klog/v2 and stdlib log to coexist

If you need klog/v2, glog and stdlib log to coexist, please use https://github.com/gomodules/kglog

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the same value as the global flags.

func FlushLogs

func FlushLogs()

FlushLogs flushes logs immediately.

func GlogSetter

func GlogSetter(val string) (string, error)

GlogSetter is a setter to set glog level.

func Init

func Init(rootCmd *cobra.Command, printFlags bool)

Init initializes logs the way we want for AppsCode codebase.

func InitLogs

func InitLogs()

InitLogs initializes logs the way we want for kubernetes.

func NewLogger

func NewLogger(prefix string) *log.Logger

NewLogger creates a new log.Logger which sends logs to klog.Info.

func WordSepNormalizeFunc

func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WordSepNormalizeFunc changes all flags that contain "_" separators

Types

type HTTPLogger added in v0.0.3

type HTTPLogger struct{}

HTTPLogger serves as a bridge between the standard log package and the klog package.

func (HTTPLogger) Write added in v0.0.3

func (writer HTTPLogger) Write(data []byte) (n int, err error)

Write implements the io.Writer interface.

type KlogWriter

type KlogWriter struct{}

KlogWriter serves as a bridge between the standard log package and the klog package.

func (KlogWriter) Write

func (writer KlogWriter) Write(data []byte) (n int, err error)

Write implements the io.Writer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL