Documentation
¶
Index ¶
- Constants
- func AssertEqual(expected, actual interface{}, msgAndArgs ...interface{}) bool
- func AssertEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool
- func AssertFalse(value bool, msgAndArgs ...interface{}) bool
- func AssertFalsef(value bool, msg string, args ...interface{}) bool
- func AssertNil(object interface{}, msgAndArgs ...interface{}) bool
- func AssertNilF(object interface{}, msg string, args ...interface{}) bool
- func AssertNotNil(object interface{}, msgAndArgs ...interface{}) bool
- func AssertNotNilF(object interface{}, msg string, args ...interface{}) bool
- func AssertTrue(value bool, msgAndArgs ...interface{}) bool
- func AssertTruef(value bool, msg string, args ...interface{}) bool
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func FatalIfError(err error, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func FatalfIfError(err error, format string, args ...interface{})
- func GetLevelString(level Level) string
- func Infof(format string, args ...interface{})
- func Log(level Level, msg interface{})
- func Logf(level Level, format string, args []interface{})
- func NodeLogf(nodeid NodeId, level Level, format string, args ...interface{})
- func Panic(args ...interface{})
- func PanicIfError(err error, args ...interface{})
- func Panicf(format string, args ...interface{})
- func PanicfIfError(err error, format string, args ...interface{})
- func Println(msg string)
- func SetLevel(lv Level)
- func SetOutput(outputs []string)
- func SetStdoutCallback(cb StdoutCallback)
- func TraceError(format string, args ...interface{})
- func Tracef(format string, args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type NodeLogger
- func (nl *NodeLogger) Close()
- func (nl *NodeLogger) Debugf(format string, args ...interface{})
- func (nl *NodeLogger) DisplayPendingLogEntries(ts uint64)
- func (nl *NodeLogger) Error(err error)
- func (nl *NodeLogger) Errorf(format string, args ...interface{})
- func (nl *NodeLogger) Info(format string)
- func (nl *NodeLogger) Infof(format string, args ...interface{})
- func (nl *NodeLogger) IsFileEnabled() bool
- func (nl *NodeLogger) IsLevelVisible(level Level) bool
- func (nl *NodeLogger) Log(level Level, msg string)
- func (nl *NodeLogger) LogOt(levelAndMsg string)
- func (nl *NodeLogger) Logf(level Level, format string, args []interface{})
- func (nl *NodeLogger) Panicf(format string, args ...interface{})
- func (nl *NodeLogger) SetDisplayLevel(level Level)
- func (nl *NodeLogger) SetFileLevel(level Level)
- func (nl *NodeLogger) Tracef(format string, args ...interface{})
- func (nl *NodeLogger) Warn(format string)
- func (nl *NodeLogger) Warnf(format string, args ...interface{})
- type StdoutCallback
Constants ¶
const ( OffLevelString = "off" NoneLevelString = "none" DefaultLevelString = "default" )
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
func AssertEqual(expected, actual interface{}, msgAndArgs ...interface{}) bool
func AssertEqualf ¶
func AssertFalse ¶
func AssertFalsef ¶
func AssertNilF ¶
func AssertNotNil ¶
func AssertNotNil(object interface{}, msgAndArgs ...interface{}) bool
func AssertNotNilF ¶
func AssertTrue ¶
func AssertTruef ¶
func FatalIfError ¶
func FatalIfError(err error, args ...interface{})
func FatalfIfError ¶
func GetLevelString ¶
func Log ¶
func Log(level Level, msg interface{})
Log outputs the log message/object at specified level using logger.
func NodeLogf ¶
NodeLogf logs a formatted log message for the specific nodeid; correct NodeLogger object will be auto-found.
func PanicIfError ¶
func PanicIfError(err error, args ...interface{})
func PanicfIfError ¶
func Println ¶
func Println(msg string)
Println prints a message for the user at the current console/CLI, to stdout, without logging fields.
func SetOutput ¶
func SetOutput(outputs []string)
SetOutput sets the output writer e.g. logger.SetOutput([]string{"stderr", "otns.log"}) // for @DEBUG: generate a log output file.
func SetStdoutCallback ¶
func SetStdoutCallback(cb StdoutCallback)
SetStdoutCallback sets a callback, that the logger will call when new log content was written to stdout/stderr.
func TraceError ¶
func TraceError(format string, args ...interface{})
TraceError prints the stack and error
Types ¶
type Level ¶
type Level int8
Level is the log-level for logging what happens in the simulation as a whole, or to watch an individual node. Values inherit OT logging.h values and extend these with OT-NS specific items.
func ParseLevelString ¶
func ParseOtLogLine ¶
ParseOtLogLine attempts to parse line as an OT generated log line with timestamp/level/message. Returns true if successful and also returns the determined log level of the log line.
type NodeLogger ¶
type NodeLogger struct {
Id NodeId
// contains filtered or unexported fields
}
NodeLogger is a node-specific log object. Levels and output file can be set per individual node.
func GetNodeLogger ¶
func GetNodeLogger(outputDir string, simulationId int, cfg *NodeConfig) *NodeLogger
GetNodeLogger gets the NodeLogger instance for the given ( simulation ID, node config ) and configures it.
func (*NodeLogger) Close ¶
func (nl *NodeLogger) Close()
Close closes the node log file and also saves/displays any pending entries.
func (*NodeLogger) Debugf ¶
func (nl *NodeLogger) Debugf(format string, args ...interface{})
func (*NodeLogger) DisplayPendingLogEntries ¶
func (nl *NodeLogger) DisplayPendingLogEntries(ts uint64)
DisplayPendingLogEntries displays all pending log entries for the node, using given simulation time ts. This includes writing any pending entries to the node log file.
func (*NodeLogger) Error ¶
func (nl *NodeLogger) Error(err error)
func (*NodeLogger) Errorf ¶
func (nl *NodeLogger) Errorf(format string, args ...interface{})
func (*NodeLogger) Info ¶
func (nl *NodeLogger) Info(format string)
func (*NodeLogger) Infof ¶
func (nl *NodeLogger) Infof(format string, args ...interface{})
func (*NodeLogger) IsFileEnabled ¶
func (nl *NodeLogger) IsFileEnabled() bool
IsFileEnabled returns true if logging to file is currently enabled, false if not.
func (*NodeLogger) IsLevelVisible ¶
func (nl *NodeLogger) IsLevelVisible(level Level) bool
func (*NodeLogger) Log ¶
func (nl *NodeLogger) Log(level Level, msg string)
func (*NodeLogger) LogOt ¶
func (nl *NodeLogger) LogOt(levelAndMsg string)
LogOt logs a complete OT format log string, which includes timestamp, log level character, and the log message. The right level to log is automatically determined.
func (*NodeLogger) Logf ¶
func (nl *NodeLogger) Logf(level Level, format string, args []interface{})
func (*NodeLogger) Panicf ¶
func (nl *NodeLogger) Panicf(format string, args ...interface{})
func (*NodeLogger) SetDisplayLevel ¶
func (nl *NodeLogger) SetDisplayLevel(level Level)
func (*NodeLogger) SetFileLevel ¶
func (nl *NodeLogger) SetFileLevel(level Level)
func (*NodeLogger) Tracef ¶
func (nl *NodeLogger) Tracef(format string, args ...interface{})
func (*NodeLogger) Warn ¶
func (nl *NodeLogger) Warn(format string)
func (*NodeLogger) Warnf ¶
func (nl *NodeLogger) Warnf(format string, args ...interface{})
type StdoutCallback ¶
type StdoutCallback interface {
OnStdout()
}