Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefaultLogger() logger.Logger
- func GetLogger(prefix string) logger.Logger
- func InitLogger(log *logger.Logger, prefix interface{})
- func Polyfill(opts Options, fill Options) error
- func ValidateOptions(opts Options) (*flag.FlagSet, error)
- func ValidateOptionsWithFlags(opts Options, args ...string) (*flag.FlagSet, error)
- type LoggerOptions
- type Options
- type SeedOptions
Constants ¶
View Source
const ( OptionName = "name" OptionDesc = "description" )
View Source
const (
LogDefault = "default"
)
Variables ¶
View Source
var ( DefaultLogLevel = logger.LOG_LEVEL_INFO LogLevel = DefaultLogLevel LogColor = true Verbose bool )
View Source
var ( Flag *flag.FlagSet = flag.NewFlagSet("", flag.ContinueOnError) ErrNonPointer = errors.New("validate with non-pointer") ErrPrintUsage = errors.New("print usage") )
Functions ¶
func GetDefaultLogger ¶
func InitLogger ¶
func ValidateOptions ¶
ValidateOptions validates the options with command line arguments. Returns a FlagSet and error. If returns ErrPrintUsage, the usage should be printed.
Types ¶
type LoggerOptions ¶
type LoggerOptions struct { Options Debug bool `name:"debug" description:"Display debug logs."` Verbose bool `name:"v" description:"Display verbose logs."` }
func (*LoggerOptions) Validate ¶
func (o *LoggerOptions) Validate() error
type Options ¶
type Options interface { // Validate validates the options. Validate() error // contains filtered or unexported methods }
Options is the interface for all config options. See the package-level substructs to define your options.
func NewOptions ¶
func NewOptions() Options
type SeedOptions ¶
type SeedOptions struct { Options Seed int64 `name:"seed" description:"Random seed to reproduce simulation."` }
func (*SeedOptions) Validate ¶
func (opts *SeedOptions) Validate() error
Click to show internal directories.
Click to hide internal directories.