defaults

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CurrentTime returns the current time with time.Time.
	CurrentTime = time.Now

	// HandleError handles an error passed to it.
	// You can collect all errors and count them for reporting.
	// Notice that this function is called synchronously, so don't do too many things in it.
	HandleError = func(label string, err error) {}
)
View Source
var (
	// CallerDepth is the depth of caller.
	// See runtime.Caller.
	CallerDepth = 4

	// LevelPrint is the level used for printing logs.
	LevelPrint = slog.LevelInfo
)
View Source
var (
	// MinBufferSize is the min buffer size used in bytes.
	MinBufferSize = 1 * 1024

	// MaxBufferSize is the max buffer size used in bytes.
	MaxBufferSize = 16 * 1024
)
View Source
var (
	// FileMode is the permission bits
	FileMode os.FileMode = 0644

	// FileDirMode is the permission bits of directory.
	FileDirMode os.FileMode = 0755
)
View Source
var (
	// OpenFile opens a file of path with given mode.
	OpenFile = func(path string, mode os.FileMode) (*os.File, error) {
		return os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, mode)
	}

	// OpenFileDir opens a dir of path with given mode.
	OpenFileDir = func(path string, mode os.FileMode) error {
		return os.MkdirAll(path, mode)
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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