greasego

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const GREASE_JSON_ESCAPE_STRINGS uint32 = C.GREASE_JSON_ESCAPE_STRINGS
View Source
const GREASE_LIB_NOT_FOUND int = 0x01E00000
View Source
const GREASE_LIB_OK int = 0
View Source
const GREASE_LIB_SET_FILEOPTS_FLAGS uint32 = 0x20000000
View Source
const GREASE_LIB_SET_FILEOPTS_MAXFILES uint32 = 0x40000000
View Source
const GREASE_LIB_SET_FILEOPTS_MAXFILESIZE uint32 = 0x80000000
View Source
const GREASE_LIB_SET_FILEOPTS_MAXTOTALSIZE uint32 = 0x01000000
View Source
const GREASE_LIB_SET_FILEOPTS_MODE uint32 = 0x10000000
View Source
const GREASE_LIB_SET_FILEOPTS_ROTATE uint32 = 0x04000000 // set if you want files to rotate, if not set all other rotate options are skipped
View Source
const GREASE_LIB_SET_FILEOPTS_ROTATEONSTART uint32 = 0x02000000 // set if you want files to rotate on start
View Source
const GREASE_LIB_SET_FILTER_MASK uint32 = 0x8
View Source
const GREASE_LIB_SET_FILTER_ORIGIN uint32 = 0x1
View Source
const GREASE_LIB_SET_FILTER_TAG uint32 = 0x2
View Source
const GREASE_LIB_SET_FILTER_TARGET uint32 = 0x4
View Source
const GREASE_LIB_SINK_KLOG uint32 = 0x4
View Source
const GREASE_LIB_SINK_KLOG2 uint32 = 0x5
View Source
const GREASE_LIB_SINK_PIPE uint32 = 0x2
View Source
const GREASE_LIB_SINK_SYSLOGDGRAM uint32 = 0x3
View Source
const GREASE_LIB_SINK_UNIXDGRAM uint32 = 0x1

Variables

This section is empty.

Functions

func AddFDForStderr

func AddFDForStderr(fd int, originId uint32)

func AddFDForStdout

func AddFDForStdout(fd int, originId uint32)

func AddFilter

func AddFilter(opts *GreaseLibFilter) int

func AddLevelLabel

func AddLevelLabel(val uint32, label string)

func AddOriginLabel

func AddOriginLabel(val uint32, label string)

func AddSink

func AddSink(sink *GreaseLibSink) int

func AddTagLabel

func AddTagLabel(val uint32, label string)

func AddTarget

func AddTarget(opts *GreaseLibTargetOpts, cb GreaseLibAddTargetCB)

func AssignChildClosedFDCallback

func AssignChildClosedFDCallback(cb GreaseLibProcessClosedRedirectCallback)

func AssignFromStruct

func AssignFromStruct(opts interface{}, obj interface{})

Assigns values to a struct based on StructTags of `greaseAssign` and `greaseType` Not that with string, this always assumes the structure it will fill will have a *string, not a string

func DeleteFilter

func DeleteFilter(opts *GreaseLibFilter) int

func DisableFilter

func DisableFilter(opts *GreaseLibFilter) int

func EnableFilter

func EnableFilter(opts *GreaseLibFilter) int

func GetAllTargetsAndFilters

func GetAllTargetsAndFilters() ([]GreaseLibTargetOpts, []GreaseLibFilter)

func GetGreaseLibVersion

func GetGreaseLibVersion() (ret string)

GetGreaseLibVersion returns the version of the underlying greaseLib.so shared library in use

func GetTargetId

func GetTargetId(name string) uint32

return value = 0 means the target name doesn't exist return value > 0 is the ID of the target

func GetTargetName

func GetTargetName(id uint32) string

func GetUnusedOriginId

func GetUnusedOriginId() (goret uint32)

func GetUnusedTagId

func GetUnusedTagId() (goret uint32)

func LogDebug

func LogDebug(a ...interface{})

func LogDebug_noOrigin

func LogDebug_noOrigin(a ...interface{})

func LogDebugf

func LogDebugf(format string, a ...interface{})

func LogDebugf_noOrigin

func LogDebugf_noOrigin(format string, a ...interface{})

func LogError

func LogError(a ...interface{})

func LogError_noOrigin

func LogError_noOrigin(a ...interface{})

func LogErrorf

func LogErrorf(format string, a ...interface{})

func LogErrorf_noOrigin

func LogErrorf_noOrigin(format string, a ...interface{})

func LogInfo

func LogInfo(a ...interface{})

func LogInfo_noOrigin

func LogInfo_noOrigin(a ...interface{})

func LogInfof

func LogInfof(format string, a ...interface{})

func LogInfof_noOrigin

func LogInfof_noOrigin(format string, a ...interface{})

func LogSuccess

func LogSuccess(a ...interface{})

func LogSuccess_noOrigin

func LogSuccess_noOrigin(a ...interface{})

func LogSuccessf

func LogSuccessf(format string, a ...interface{})

func LogSuccessf_noOrigin

func LogSuccessf_noOrigin(format string, a ...interface{})

func LogWarning

func LogWarning(a ...interface{})

func LogWarning_noOrigin

func LogWarning_noOrigin(a ...interface{})

func LogWarningf

func LogWarningf(format string, a ...interface{})

func LogWarningf_noOrigin

func LogWarningf_noOrigin(format string, a ...interface{})

func ModifyDefaultTarget

func ModifyDefaultTarget(opts *GreaseLibTargetOpts) int

func ModifyFilter

func ModifyFilter(opts *GreaseLibFilter) int

func RemoveFDForStderr

func RemoveFDForStderr(fd int)

func RemoveFDForStdout

func RemoveFDForStdout(fd int)

func RetireCallbackData

func RetireCallbackData(data *TargetCallbackData)

after calling this function, the data, and any slice form GetBufferAsSlice() is invalid

func SetFileOpts

func SetFileOpts(opts GreaseLibTargetOpts, flag uint32, val uint32)

func SetFilterValue

func SetFilterValue(filter *GreaseLibFilter, flag uint32, val uint32)

func SetInternalLogOrigin

func SetInternalLogOrigin(originid uint32, name string)

func SetInternalTagName

func SetInternalTagName(name string)

func SetSelfOriginLabel

func SetSelfOriginLabel(label string)

func SetupStandardLevels

func SetupStandardLevels() int

func SetupStandardTags

func SetupStandardTags() int

func StartGreaseLib

func StartGreaseLib(cb GreaseLibStartCB)

Start the library. The the cb.GreaseLib_start_cb() callback will be called upon start.

func TargetOptsSetFlags

func TargetOptsSetFlags(opts *GreaseLibTargetOpts, flag uint32)

Types

type GreaseError

type GreaseError struct {
	Str   string
	Errno int
}

GreaseError is used for error reporting from greaseLib, and is analagous to the same structure in the C library. An errornum of 0 means 'no error'

func ConvertCGreaseError

func ConvertCGreaseError(err *C.GreaseLibError) *GreaseError

type GreaseIdMap

type GreaseIdMap map[string]uint32
var DefaultLevelMap GreaseIdMap
var DefaultTagMap GreaseIdMap
var TargetMap GreaseIdMap

[string]:[target ID]

type GreaseLevel

type GreaseLevel uint32
const GREASE_ALL_LEVELS GreaseLevel = 0xFFFFFFFF //C.GREASE_ALL_LEVELS

type GreaseLib

type GreaseLib struct {
	// contains filtered or unexported fields
}

The GreaseLib structure represents a single instantiation of the library. For now, only one instantiation is supported.

type GreaseLibAddTargetCB

type GreaseLibAddTargetCB func(err *GreaseError, optsId int, targId uint32)

Callback used for a callback which

type GreaseLibCallbackEvent

type GreaseLibCallbackEvent struct {
	// contains filtered or unexported fields
}

type GreaseLibCallbackNoData

type GreaseLibCallbackNoData interface {
	// contains filtered or unexported methods
}

This generic interfaces represents places in the greaseLib where the C GreaseLibCallback(err,void *) is used, but no data is ever passed back with the void pointer

type GreaseLibFilter

type GreaseLibFilter struct {
	Origin uint32
	Tag    uint32
	Target uint32
	Mask   uint32

	//	_enabledFlags uint32
	//	origin uint32
	//	tag uint32
	//	target uint32
	//	mask uint32
	//	id uint32
	Format_pre          *string
	Format_post         *string
	Format_post_pre_msg *string
	// contains filtered or unexported fields
}

func NewGreaseLibFilter

func NewGreaseLibFilter() *GreaseLibFilter

type GreaseLibProcessClosedRedirectCallback

type GreaseLibProcessClosedRedirectCallback func(err *GreaseError, stream_type int, pid int)

type GreaseLibSink

type GreaseLibSink struct {
	// contains filtered or unexported fields
}

func NewGreaseLibSink

func NewGreaseLibSink(sinkType uint32, path *string) *GreaseLibSink

type GreaseLibStartCB

type GreaseLibStartCB func()

This interface is for providing a special callback to called when the greaseLib starts

type GreaseLibTargetCB

type GreaseLibTargetCB func(err *GreaseError, data *TargetCallbackData)

This interface is used for a 'callback target' in go. The greaseLibCallback(err,data) will be called with a 'data' string representing all log data since the last callback

type GreaseLibTargetFileOpts

type GreaseLibTargetFileOpts struct {
	Mode            uint32 // permissions for file (recommend default)
	Flags           uint32 // file flags (recommend default)
	Max_files       uint32 // max # of files to maintain (rotation)
	Max_file_size   uint32 // max size for any one file
	Max_total_size  uint64 // max total size to maintain in rotation
	Rotate_on_start bool
	// contains filtered or unexported fields
}

type GreaseLibTargetOpts

type GreaseLibTargetOpts struct {
	Delim          *string
	TTY            *string
	File           *string
	OptsId         int                      // filled in automatically
	TargetCB       GreaseLibTargetCB        // used if this is target is a callback
	FileOpts       *GreaseLibTargetFileOpts // nil if not used
	Format_pre     *string
	Format_time    *string
	Format_level   *string
	Format_tag     *string
	Format_origin  *string
	Format_post    *string
	Format_pre_msg *string
	Name           *string // not used by greaseLib - but used for a string reference name

	NumBanks uint32
	// contains filtered or unexported fields
}

analgous to greaseLib GreaseLibTargetOpts

func NewGreaseLibTargetOpts

func NewGreaseLibTargetOpts() *GreaseLibTargetOpts

type TargetCallbackData

type TargetCallbackData struct {
	// contains filtered or unexported fields
}

func (*TargetCallbackData) GetBufferAsSlice

func (data *TargetCallbackData) GetBufferAsSlice() []byte

Jump to

Keyboard shortcuts

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