Documentation
¶
Index ¶
- Constants
- func Caller() string
- func ExeDirJoin(elem ...string) string
- func IsHostname(s string) bool
- func IsIPv4(s string) bool
- func IsNetPort(str string) bool
- func IsTLSCert(block string) bool
- func IsUUID(s string) bool
- func NewUUID() string
- func ReadJSONFile(name string, data interface{}) error
- func ReadTestConfig(conf interface{})
- func RootPath() string
- func TestExpectResult(t *testing.T, op string, expected, actual error)
- func ValidateMethod(f http.HandlerFunc, method string) http.HandlerFunc
- func WriteJSONFile(name, prefix, indent string, data interface{}) error
- type LogConfig
- type Logger
- func (l *Logger) Debug(fmt string, v ...interface{})
- func (l *Logger) Error(fmt string, v ...interface{})
- func (l *Logger) Fatal(fmt string, v ...interface{})
- func (l *Logger) Info(fmt string, v ...interface{})
- func (l *Logger) Log(lvl int, fmt string, v ...interface{})
- func (l *Logger) Warn(fmt string, v ...interface{})
Constants ¶
const ( LogDebug = iota LogInfo = iota LogWarning = iota LogError = iota LogFatal = iota )
Log levels.
Variables ¶
This section is empty.
Functions ¶
func Caller ¶
func Caller() string
Caller returns a caller's call location. If F1 calls F2 which in its turn calls Caller, then this function will return a location within F1 where it calls F2.
func ExeDirJoin ¶
ExeDirJoin composes a file name relative to a running executable.
func ReadJSONFile ¶
ReadJSONFile reads and parses a JSON file filling a given data instance.
func ReadTestConfig ¶
func ReadTestConfig(conf interface{})
ReadTestConfig parses command line and reads configuration.
func TestExpectResult ¶
TestExpectResult compares two errors and fails a test if they don't match.
func ValidateMethod ¶
func ValidateMethod(f http.HandlerFunc, method string) http.HandlerFunc
ValidateMethod returns not acceptable for methods other then given.
func WriteJSONFile ¶
WriteJSONFile converts a given data instance to JSON and writes it to file.
Types ¶
type LogConfig ¶
type LogConfig struct {
Level string
}
LogConfig is a logger configuration.
func NewLogConfig ¶
func NewLogConfig() *LogConfig
NewLogConfig creates a default log configuration.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger to log internal events.
func NewTestLogger ¶
NewTestLogger creates a new logger.