Documentation
¶
Overview ¶
Package info is a simple logger that displays detailed information when the "--verbose" flag is set.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Prefix = "[LOG]: "
Prefix is the prefix of each record in the log.
Functions ¶
func Log ¶
Log writes the given logs to the log buffer.
Note that if a "logs" is empty, or all blank, nothing is recorded.
Example ¶
// To avoid conflicts during testing this example, back up the current buffer // and restore it later. This is usually not necessary. oldLogBuff := logBuff defer func() { logBuff = oldLogBuff }() /* Example usage */ // Log if _, err := Log("This", "is", "the", "log1"); err != nil { log.Println(err) return } // Logging if _, err := Log("This", "is", "the", "log2"); err != nil { log.Println(err) return } // Get the current log. fmt.Println("Log output:") fmt.Println(Get()) // Clear the log. Clear() // After calling `Clear()` the log becomes empty. fmt.Printf("Is log after 'Clear()' call empty: ") if Get() == "" { fmt.Println("yes") } else { fmt.Println("no") }
Output: Log output: [LOG]: This is the log1 [LOG]: This is the log2 Is log after 'Clear()' call empty: yes
func NormalizeIPv4 ¶
NormalizeIPv4 will trim the zero padded IP address. For example, "001.001.001.001" will be "1.1.1.1".
**Note** that it is not a validator. If the given ipAddress is invalid it will return as is.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.