Documentation
¶
Index ¶
- Constants
- func AddLoggingLayerToCommand(cmd cmds.Command) (cmds.Command, error)
- func AddLoggingLayerToRootCommand(rootCmd *cobra.Command, appName string) error
- func InitLoggerFromSettings(settings *LoggingSettings) error
- func InitLoggerFromViper() error
- func InitLoggerWithConfig(config *LogConfig) error
- func InitViper(appName string, rootCmd *cobra.Command) error
- func InitViperInstanceWithAppName(appName string, configFile string) (*viper.Viper, error)
- func InitViperWithAppName(appName string, configFile string) error
- func NewLoggingLayer() (layers.ParameterLayer, error)
- type LogConfig
- type LoggingSettings
- type LogstashWriter
Constants ¶
View Source
const LoggingLayerSlug = "logging"
Variables ¶
This section is empty.
Functions ¶
func AddLoggingLayerToCommand ¶
AddLoggingLayerToCommand adds the logging layer to a Glazed command
func InitLoggerFromSettings ¶
func InitLoggerFromSettings(settings *LoggingSettings) error
InitLoggerFromSettings initializes the logger based on the provided settings
func InitLoggerFromViper ¶
func InitLoggerFromViper() error
InitLoggerFromViper initializes the logger using settings from Viper
func InitLoggerWithConfig ¶
func InitViperWithAppName ¶
func NewLoggingLayer ¶
func NewLoggingLayer() (layers.ParameterLayer, error)
NewLoggingLayer creates a new parameter layer for logging configuration
Types ¶
type LoggingSettings ¶
type LoggingSettings struct {
WithCaller bool `glazed.parameter:"with-caller"`
LogLevel string `glazed.parameter:"log-level"`
LogFormat string `glazed.parameter:"log-format"`
LogFile string `glazed.parameter:"log-file"`
LogstashEnabled bool `glazed.parameter:"logstash-enabled"`
LogstashHost string `glazed.parameter:"logstash-host"`
LogstashPort int `glazed.parameter:"logstash-port"`
LogstashProtocol string `glazed.parameter:"logstash-protocol"`
LogstashAppName string `glazed.parameter:"logstash-app-name"`
LogstashEnvironment string `glazed.parameter:"logstash-environment"`
}
LoggingSettings holds the logging configuration parameters
type LogstashWriter ¶
type LogstashWriter struct {
Host string
Port int
Protocol string // "tcp" or "udp"
AppName string
Environment string
// contains filtered or unexported fields
}
LogstashWriter implements io.Writer interface for sending logs to Logstash via TCP or UDP
func NewLogstashWriter ¶
func NewLogstashWriter(host string, port int, protocol, appName, environment string) *LogstashWriter
NewLogstashWriter creates a new LogstashWriter for sending logs to Logstash
func SetupLogstashLogger ¶
func SetupLogstashLogger(host string, port int, protocol, appName, environment string) *LogstashWriter
SetupLogstashLogger configures a logger that sends logs to Logstash
func (*LogstashWriter) Close ¶
func (w *LogstashWriter) Close() error
Close closes the connection to Logstash
Click to show internal directories.
Click to hide internal directories.