utils

package
v0.0.0-...-86d57c8 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2018 License: GPL-2.0, GPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	YAML = iota
	JSON
)

Variables

View Source
var DefaultLogger = NewLogger("[Specter]")
View Source
var ErrUnexpectedType = errors.New("unexpected type")

Functions

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists or not on the specified system path.

func PanicErr

func PanicErr(err error)

PanicErr checks if the given error is a nil and if it's not, it panic it.

Types

type Config

type Config struct {
	Path     string
	Type     uint
	Defaults interface{}
}

func NewConfig

func NewConfig(path string, Type uint, defaults interface{}) (c Config)

func (*Config) Marshal

func (c *Config) Marshal(in interface{})

func (*Config) Unmarshal

func (c *Config) Unmarshal(out *interface{})

type Logger

type Logger struct {
	Prefix string
}

func NewLogger

func NewLogger(prefix string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(active bool, text ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(text ...interface{})

func (*Logger) Info

func (l *Logger) Info(text ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(text ...interface{})

Jump to

Keyboard shortcuts

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