Documentation ¶
Overview ¶
Package common provides constants and utility functions that are shared across the poa packages
Index ¶
- Constants
- Variables
- func CheckIP(ip string, portOnlyOk bool) bool
- func CheckMoniker(moniker string) bool
- func ClearScreen()
- func DebugMessage(a ...interface{}) (n int, err error)
- func DefaultLogger() *logrus.Logger
- func ErrorMessage(a ...interface{}) (n int, err error)
- func GetMyIP() string
- func InfoMessage(a ...interface{}) (n int, err error)
- func LogLevel(l string) logrus.Level
- func MessageWithType(msgType int, a ...interface{}) (n int, err error)
- func MustPrintJSON(jsonObject interface{}) error
- func PromptMessage(a ...interface{}) (n int, err error)
Constants ¶
const ( ColourInfo = color.FgGreen ColourWarning = color.FgHiMagenta ColourError = color.FgHiRed ColourPrompt = color.FgHiYellow ColourOther = color.FgYellow ColourOutput = color.FgHiCyan ColourDebug = color.FgCyan )
Colour definitions as used in the Message functions in this unit.
const ( MsgInformation = 0 MsgWarning = 1 MsgError = 2 MsgPrompt = 3 MsgDebug = 4 MsgOther = 5 )
Log level constants
Variables ¶
var MonikerRegexp = regexp.MustCompile("^[a-zA-Z0-9_]*$")
MonikerRegexp defines the set of characters that monikers can be composed of.
var ( // VerboseLogging is a globals that controls debug message output. It is // Controlled by the --verbose option in monetd. VerboseLogging bool )
Functions ¶
func CheckMoniker ¶ added in v0.2.0
CheckMoniker verifies if the moniker matches the MonikerRegexp.
func ClearScreen ¶
func ClearScreen()
ClearScreen clears the CLI screen. Implementation is OS-specific
func DebugMessage ¶ added in v0.2.0
DebugMessage is a simple wrapper for stdout logging. Setting VerboseLayout to false disables its output
func DefaultLogger ¶ added in v0.2.0
DefaultLogger returns a default logger instance
func ErrorMessage ¶ added in v0.2.0
ErrorMessage is a simple wrapper for stdout logging for Error Messages.
func InfoMessage ¶ added in v0.2.0
InfoMessage is a simple wrapper for stdout logging of Information Messages
func MessageWithType ¶
MessageWithType is a central point for cli logging messages It colour codes the output, suppressing Debug messages if VerboseLogging is false
func MustPrintJSON ¶ added in v0.2.0
func MustPrintJSON(jsonObject interface{}) error
MustPrintJSON prints the JSON encoding of the given object and exits the program with an error message when the marshaling fails.
func PromptMessage ¶ added in v0.3.0
PromptMessage displays a prompt message in the appropriate color.
Types ¶
This section is empty.