layout

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout

type Layout uint8

Layout is the type of single flags of the the Layout.

const (
	// FullFilePath flag adding in the log message the path to
	// the go-file where the logging method was called.
	FullFilePath Layout = 1 << iota

	// ShortFilePath flag adding in the log message the short path
	// to the go-file where the logging method was called.
	ShortFilePath

	// FuncName flag adding in the log message the function's name
	// where the logging method was called.
	FuncName

	// FuncAddress flag adding in the log message the function's address
	// where the logging method was called.
	FuncAddress

	// LineNumber flag adding in the log message the line number
	// of the go-file where the logging method was called.
	LineNumber

	// Default is the default format for the log message.
	Default = ShortFilePath | FuncName | LineNumber

	// None is an explicit "no layout fields" sentinel for an Output's Layouts.
	// A zero Layouts is treated as "use Default" for backward compatibility, so
	// None is the way to actually disable caller info; the logger then also
	// skips the (relatively expensive) stack-frame capture. It is a
	// configuration marker consumed by SetOutputs/EditOutputs and never stored,
	// so it is deliberately outside the valid single-flag range.
	None Layout = 1 << 6
)

func (*Layout) Add

func (l *Layout) Add(flags ...Layout) (Layout, error)

Add adds the specified flags ignores duplicates or flags that value already contains. Returns a new value if all is well or old value and an error if one or more invalid flags are specified.

func (*Layout) All

func (l *Layout) All(flags ...Layout) bool

All returns true if all of the specified flags are set.

func (*Layout) Any

func (l *Layout) Any(flags ...Layout) bool

Any returns true if at least one of the specified flags is set.

func (*Layout) Contains

func (l *Layout) Contains(flag Layout) (bool, error)

Contains method returns true if value contains the specified flag. Returns false and an error if the value is invalid or an invalid flag is specified.

func (*Layout) Delete

func (l *Layout) Delete(flags ...Layout) (Layout, error)

Delete deletes the specified flags ignores duplicates or flags that were not set. Returns a new value if all is well or old value and an error if one or more invalid flags are specified.

func (*Layout) FilePath

func (l *Layout) FilePath() bool

FilePath returns true if value contains the FullPath or ShortPath flags. Returns false and an error if the value is invalid.

func (*Layout) FullFilePath

func (l *Layout) FullFilePath() bool

FullFilePath returns true if value contains the FullPath flag.

func (*Layout) FuncAddress

func (l *Layout) FuncAddress() bool

FuncAddress returns true if value contains the FuncAddress flag.

func (*Layout) FuncName

func (l *Layout) FuncName() bool

FuncName returns true if value contains the FuncName flag.

func (*Layout) IsSingle

func (l *Layout) IsSingle() bool

IsSingle returns true if value contains single of the available flag. The custom flags cannot be valid since they should not affect the formatting settings. The zero value is an invalid flag too.

func (*Layout) IsValid

func (l *Layout) IsValid() bool

IsValid returns true if value contains zero, one or an unique sum of valid FormatFlag flags. The zero value is a valid value.

func (*Layout) LineNumber

func (l *Layout) LineNumber() bool

LineNumber returns true if value contains the LineNumber flag.

func (*Layout) Set

func (l *Layout) Set(flags ...Layout) (Layout, error)

Set sets the specified flags ignores duplicates. The flags that were set previously will be discarded. Returns a new value if all is well or old value and an error if one or more invalid flags are specified.

func (*Layout) ShortFilePath

func (l *Layout) ShortFilePath() bool

ShortFilePath returns true if value contains the ShortPath flag.

Jump to

Keyboard shortcuts

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