Documentation ¶
Index ¶
- type Assertion
- type AssertionFunc
- type Client
- type Config
- type Env
- type Headers
- type Level
- type LevelLogger
- func (l *LevelLogger) Debug(format string, args ...interface{})
- func (l *LevelLogger) Error(format string, args ...interface{})
- func (l *LevelLogger) Fatal(format string, args ...interface{})
- func (l *LevelLogger) Info(format string, args ...interface{})
- func (l *LevelLogger) Warn(format string, args ...interface{})
- type Logger
- type Reqfile
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶
type AssertionFunc ¶
func ParseAssertion ¶
func ParseAssertion(cond string) AssertionFunc
type Config ¶
type Config struct { Root string `toml:"root"` DefaultEnv string `toml:"default_env"` Aliases map[string]string `toml:"aliases"` Environments map[string]Env `toml:"environments"` }
func ParseConfig ¶
func (*Config) DeleteEnvValue ¶
func (*Config) SetEnvValue ¶
type Level ¶
type Level int
Level represents a logging level. This restricts the logger to print only messages with at least this level.
The available logging levels.
func ParseLevel ¶
ParseLevel converts a string to the corresponding Level. Comparisons are case insensitive. If an unknown level is provided, then an error will be returned.
type LevelLogger ¶
type LevelLogger struct {
// contains filtered or unexported fields
}
LevelLogger implements the Logger interface using the defined Level constants. The provided level is treated as the minimum. Any messages passed to a level that is at least the defined level will be printed.
Every log message is treated as a single line. If there is no newline at the end of the message, then one will be added.
func NewLevelLogger ¶
func NewLevelLogger(level Level, out io.Writer) (*LevelLogger, error)
NewLevelLogger constructs a new logger. An error will be returned if an invalid level is provided. If no output writer is provided, then os.Stdout will be used.
func (*LevelLogger) Debug ¶
func (l *LevelLogger) Debug(format string, args ...interface{})
Logs at the LevelDebug level.
func (*LevelLogger) Error ¶
func (l *LevelLogger) Error(format string, args ...interface{})
Logs at the LevelError level.
func (*LevelLogger) Fatal ¶
func (l *LevelLogger) Fatal(format string, args ...interface{})
Logs at the LevelFatal level then calls os.Exit(1).
func (*LevelLogger) Info ¶
func (l *LevelLogger) Info(format string, args ...interface{})
Logs at the LevelInfo level.
func (*LevelLogger) Warn ¶
func (l *LevelLogger) Warn(format string, args ...interface{})
Logs at the LevelWarn level.
type Logger ¶
type Logger interface { // Logs at the LevelDebug level. Debug(format string, args ...interface{}) // Logs at the LevelInfo level. Info(format string, args ...interface{}) // Logs at the LevelWarn level. Warn(format string, args ...interface{}) // Logs at the LevelError level. Error(format string, args ...interface{}) // Logs at the LevelFatal level then calls os.Exit(1). Fatal(format string, args ...interface{}) }
Logger represents a standard level logging interface. Every method logs the provided message using fmt.Printf with a timestamp and level prefix. Fatal logs the message like the other methods, but calls os.Exit(1) afterwards.