Documentation ¶
Index ¶
- Variables
- func ContainsString(arr []string, str string) bool
- func ConvertInterfaceToByteArray(mimeType string, i interface{}) (results []byte, err error)
- func CreateTextFormatterFromFormatOptions(opts *LogFormatOption) *logrus.TextFormatter
- func DeriveStaticURIFromPath(input string) (string, string)
- func GetCallerStackFrame() runtime.Frame
- func GetCurrentStackFrame() runtime.Frame
- func GetGoRoutineID() string
- func GetNewLogFilePointer(file string) (*os.File, error)
- func IsAbsolutePath(p string) bool
- func JoinBasePathIfRelativeRegularFilePath(base string, in string) (out string)
- func SanitizeUrl(url string, suffixSlash bool) string
- type LogConfig
- type LogFormatOption
- type PlankLogger
- func (l *PlankLogger) Debug(args ...interface{})
- func (l *PlankLogger) Debugf(format string, args ...interface{})
- func (l *PlankLogger) Debugln(args ...interface{})
- func (l *PlankLogger) Error(args ...interface{})
- func (l *PlankLogger) Errorf(format string, args ...interface{})
- func (l *PlankLogger) Errorln(args ...interface{})
- func (l *PlankLogger) Info(args ...interface{})
- func (l *PlankLogger) Infof(format string, args ...interface{})
- func (l *PlankLogger) Infoln(args ...interface{})
- func (l *PlankLogger) Panic(args ...interface{})
- func (l *PlankLogger) Panicf(format string, args ...interface{})
- func (l *PlankLogger) Panicln(args ...interface{})
- func (l *PlankLogger) Trace(args ...interface{})
- func (l *PlankLogger) Tracef(format string, args ...interface{})
- func (l *PlankLogger) Traceln(args ...interface{})
- func (l *PlankLogger) Warn(args ...interface{})
- func (l *PlankLogger) Warnf(format string, args ...interface{})
- func (l *PlankLogger) Warnln(args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ( InfoHeaderf = color.New(color.FgHiBlue).Add(color.Bold).PrintfFunc() InfoHeaderFprintf = color.New(color.FgHiBlue).Add(color.Bold).FprintfFunc() Infof = color.New(color.FgHiCyan).PrintfFunc() InfoFprintf = color.New(color.FgHiCyan).FprintfFunc() WarnHeaderf = color.New(color.FgHiYellow).Add(color.Bold).PrintfFunc() WarnHeaderFprintf = color.New(color.FgHiYellow).Add(color.Bold).FprintfFunc() Warnf = color.New(color.FgHiYellow).PrintfFunc() WarnFprintf = color.New(color.FgHiYellow).FprintfFunc() ErrorHeaderf = color.New(color.FgHiRed).Add(color.Bold).PrintfFunc() ErrorHeaderFprintf = color.New(color.FgHiRed).Add(color.Bold).FprintfFunc() Errorf = color.New(color.FgHiRed).PrintfFunc() ErrorFprintf = color.New(color.FgHiRed).FprintfFunc() )
var PlatformServerFlagConstants = map[string]map[string]string{
"Hostname": {
"FlagName": "hostname",
"ShortFlag": "n",
"Description": "Hostname where Plank accepts connections",
},
"Port": {
"FlagName": "port",
"ShortFlag": "p",
"Description": "Port where Plank is to be served",
},
"RootDir": {
"FlagName": "rootdir",
"ShortFlag": "r",
"Description": "Root directory for the server (default: Current directory)",
},
"Cert": {
"FlagName": "cert",
"Description": "X509 Certificate file for TLS",
},
"CertKey": {
"FlagName": "cert-key",
"Description": "X509 Certificate private Key file for TLS",
},
"Static": {
"FlagName": "static",
"ShortFlag": "s",
"Description": "Path(s) where static files will be served",
},
"SpaPath": {
"FlagName": "spa-path",
"Description": "Path to serve Single Page Application (SPA) from. The URI is derived from the leaf directory. A different URI can be specified by providing it following a colon (e.g. --spa-path ./path/to/spa-app:my-spa",
},
"NoFabricBroker": {
"FlagName": "no-fabric-broker",
"Description": "Disable Fabric (STOMP) broker",
},
"FabricEndpoint": {
"FlagName": "fabric-endpoint",
"Description": "Fabric broker endpoint",
},
"TopicPrefix": {
"FlagName": "topic-prefix",
"Description": "Topic prefix for Fabric broker",
},
"QueuePrefix": {
"FlagName": "query-prefix",
"Description": "Queue prefix for Fabric broker",
},
"RequestPrefix": {
"FlagName": "request-prefix",
"Description": "Application request prefix for Fabric broker",
},
"RequestQueuePrefix": {
"FlagName": "request-queue-prefix",
"Description": "Application request queue prefix for Fabric broker",
},
"ConfigFile": {
"FlagName": "config-file",
"Description": "Path to the server config JSON file",
},
"ShutdownTimeout": {
"FlagName": "shutdown-timeout",
"Description": "Graceful server shutdown timeout in minutes",
},
"OutputLog": {
"FlagName": "output-log",
"ShortFlag": "l",
"Description": "Platform log output. Possible values: stdout, stderr, null, or path to a file",
},
"AccessLog": {
"FlagName": "access-log",
"ShortFlag": "a",
"Description": "HTTP server access log output. Possible values: stdout, stderr, null, or path to a file",
},
"ErrorLog": {
"FlagName": "error-log",
"ShortFlag": "e",
"Description": "HTTP server error log output. Possible values: stdout, stderr, null, or path to a file",
},
"Debug": {
"FlagName": "debug",
"ShortFlag": "d",
"Description": "Enable debug logging",
},
"NoBanner": {
"FlagName": "no-banner",
"ShortFlag": "b",
"Description": "Do not print Plank banner at startup",
},
"Prometheus": {
"FlagName": "prometheus",
"Description": "Enable Prometheus for basic runtime metrics",
},
"RestBridgeTimeout": {
"FlagName": "rest-bridge-timeout",
"Description": "Time in minutes before a REST endpoint for a service request to timeout",
},
}
Functions ¶
func ContainsString ¶
func ConvertInterfaceToByteArray ¶
ConvertInterfaceToByteArray converts the interface i into a byte array. Depending on the value of mimeType being of JSON type, either JSON Marshaller is used or the interface is just straight cast to a byte array.
func CreateTextFormatterFromFormatOptions ¶
func CreateTextFormatterFromFormatOptions(opts *LogFormatOption) *logrus.TextFormatter
CreateTextFormatterFromFormatOptions takes *server.LogFormatOption and returns the pointer to a new logrus.TextFormatter instance.
func DeriveStaticURIFromPath ¶
func GetCallerStackFrame ¶
func GetCurrentStackFrame ¶
func GetGoRoutineID ¶
func GetGoRoutineID() string
func GetNewLogFilePointer ¶
GetNewLogFilePointer returns the pointer to a new os.File instance given the file name
func IsAbsolutePath ¶
IsAbsolutePath returns if path is an absolute path in *nix and Windows file systems
func SanitizeUrl ¶
SanitizeUrl removes excess forward slashes as well as pad the end of the URL with / if suffixSlash is true
Types ¶
type LogConfig ¶
type LogConfig struct { AccessLog string `json:"access_log"` ErrorLog string `json:"error_log"` OutputLog string `json:"output_log"` FormatOptions *LogFormatOption `json:"format_options"` Root string `json:"root"` // contains filtered or unexported fields }
func (*LogConfig) GetAccessLogFilePointer ¶
func (*LogConfig) GetErrorLogFilePointer ¶
func (*LogConfig) GetPlatformLogFilePointer ¶
func (*LogConfig) PrepareLogFiles ¶
type LogFormatOption ¶
type LogFormatOption struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool `json:"force_colors"` // Force disabling colors. DisableColors bool `json:"disable_colors"` // Force quoting of all values ForceQuote bool `json:"force_quote"` // DisableQuote disables quoting for all values. // DisableQuote will have a lower priority than ForceQuote. // If both of them are set to true, quote will be forced on all values. DisableQuote bool `json:"disable_quote"` // Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/ EnvironmentOverrideColors bool `json:"environment_override_colors"` // Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool `json:"disable_timestamp"` // Enable logging the full timestamp when a TTY is attached instead of just // the time passed since beginning of execution. FullTimestamp bool `json:"full_timestamp"` // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string `json:"timestamp_format"` // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool `json:"disable_sorting"` // Disables the truncation of the level text to 4 characters. DisableLevelTruncation bool `json:"disable_level_truncation"` // PadLevelText Adds padding the level text so that all the levels output at the same length // PadLevelText is a superset of the DisableLevelTruncation option PadLevelText bool `json:"pad_level_text"` // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool `json:"quote_empty_fields"` // FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &TextFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message"}} FieldMap logrus.FieldMap // contains filtered or unexported fields }
LogFormatOption is merely a wrapper of logrus.TextFormatter because TextFormatter does not allow serializing its public members of the struct
type PlankLogger ¶
var Log *PlankLogger
func (*PlankLogger) Debug ¶
func (l *PlankLogger) Debug(args ...interface{})
func (*PlankLogger) Debugf ¶
func (l *PlankLogger) Debugf(format string, args ...interface{})
func (*PlankLogger) Debugln ¶
func (l *PlankLogger) Debugln(args ...interface{})
func (*PlankLogger) Error ¶
func (l *PlankLogger) Error(args ...interface{})
func (*PlankLogger) Errorf ¶
func (l *PlankLogger) Errorf(format string, args ...interface{})
func (*PlankLogger) Errorln ¶
func (l *PlankLogger) Errorln(args ...interface{})
func (*PlankLogger) Info ¶
func (l *PlankLogger) Info(args ...interface{})
func (*PlankLogger) Infof ¶
func (l *PlankLogger) Infof(format string, args ...interface{})
func (*PlankLogger) Infoln ¶
func (l *PlankLogger) Infoln(args ...interface{})
func (*PlankLogger) Panic ¶
func (l *PlankLogger) Panic(args ...interface{})
func (*PlankLogger) Panicf ¶
func (l *PlankLogger) Panicf(format string, args ...interface{})
func (*PlankLogger) Panicln ¶
func (l *PlankLogger) Panicln(args ...interface{})
func (*PlankLogger) Trace ¶
func (l *PlankLogger) Trace(args ...interface{})
func (*PlankLogger) Tracef ¶
func (l *PlankLogger) Tracef(format string, args ...interface{})
func (*PlankLogger) Traceln ¶
func (l *PlankLogger) Traceln(args ...interface{})
func (*PlankLogger) Warn ¶
func (l *PlankLogger) Warn(args ...interface{})
func (*PlankLogger) Warnf ¶
func (l *PlankLogger) Warnf(format string, args ...interface{})
func (*PlankLogger) Warnln ¶
func (l *PlankLogger) Warnln(args ...interface{})