util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearDir

func ClearDir(directory, extension string) error

deletes all files of the given type from the requested directory this operates recursively, but does not remove the empty directories

func DirectoryList

func DirectoryList(directory string) ([]string, error)

recursively list the directories

func FileList

func FileList(directory string, extension string) ([]string, error)

Filenames will have the passed in directory as a prefix: for instance: FileList("static", "hfd") static/hfd/shelf/four_sided_shelf_with_divider.hfd static/hfd/shelf/three_sided_shelf.hfd static/hfd/shelf/three_sided_shelf_with_divider.hfd

func RelFileList

func RelFileList(directory string, extension string) ([]string, error)

Same as FileList, but strips the requested directory prefix. for instance: FileList("static", "hfd") hfd/shelf/four_sided_shelf_with_divider.hfd hfd/shelf/three_sided_shelf.hfd hfd/shelf/three_sided_shelf_with_divider.hfd

Types

type HfdLog

type HfdLog struct {

	// should we also write messages to std out?
	LogToStdOut LogLevel
	Messages    []LogMessage
	// these fields will be added to all log messages
	StaticFields *dynmap.DynMap
	// contains filtered or unexported fields
}

This logger is intended to serve a single Render operation it tracks all log messages in a queue, that can then be displayed to the end user or dropped. if Debug is on, then all messages are written to STD out.

func NewLog

func NewLog() *HfdLog

func (*HfdLog) Debugf

func (logger *HfdLog) Debugf(format string, v ...interface{})

func (*HfdLog) Debugfd

func (logger *HfdLog) Debugfd(fields *dynmap.DynMap, format string, v ...interface{})

func (*HfdLog) Errorf

func (logger *HfdLog) Errorf(format string, v ...interface{})

func (*HfdLog) Errorfd

func (logger *HfdLog) Errorfd(fields *dynmap.DynMap, format string, v ...interface{})

func (*HfdLog) HasErrors

func (logger *HfdLog) HasErrors() bool

func (*HfdLog) Infof

func (logger *HfdLog) Infof(format string, v ...interface{})

func (*HfdLog) Infofd

func (logger *HfdLog) Infofd(fields *dynmap.DynMap, format string, v ...interface{})

func (*HfdLog) Logf

func (logger *HfdLog) Logf(level LogLevel, fields *dynmap.DynMap, format string, v ...interface{})

func (*HfdLog) NewChild

func (logger *HfdLog) NewChild() *HfdLog

Creates a new logger from this one, that shares many of the same configurations, and anything logged to it, will also be logged to self

type LogLevel

type LogLevel int
const (
	Debug LogLevel = 0
	Info  LogLevel = 1
	Error LogLevel = 2
	Fatal LogLevel = 3
)

func (LogLevel) String

func (ll LogLevel) String() string

type LogMessage

type LogMessage struct {
	*dynmap.DynMap
	Timestamp time.Time
	Level     LogLevel
	Message   string
}

func (LogMessage) ToDynMap

func (lm LogMessage) ToDynMap() *dynmap.DynMap

Jump to

Keyboard shortcuts

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