Documentation
¶
Index ¶
- type Discord
- func (d *Discord) DebugWebhook() string
- func (d *Discord) ErrorWebhook() string
- func (d *Discord) FatalWebhook() string
- func (d *Discord) InfoWebhook() string
- func (d *Discord) PanicWebhook() string
- func (d *Discord) SetDebugWebhook(webhook string)
- func (d *Discord) SetErrorWebhook(webhook string)
- func (d *Discord) SetFatalWebhook(webhook string)
- func (d *Discord) SetInfoWebhook(webhook string)
- func (d *Discord) SetPanicWebhook(webhook string)
- func (d *Discord) SetWarnWebhook(webhook string)
- func (d *Discord) SetWebhook(webhook string)
- func (d *Discord) WarnWebhook() string
- func (d *Discord) Webhook() string
- type Level
- type Logger
- func (l *Logger) Debug(i ...interface{})
- func (l *Logger) DebugContext(ctx context.Context, i ...interface{})
- func (l *Logger) Debugf(format string, i ...interface{})
- func (l *Logger) Error(i ...interface{})
- func (l *Logger) ErrorContext(ctx context.Context, i ...interface{})
- func (l *Logger) Errorf(format string, i ...interface{})
- func (l *Logger) Fatal(i ...interface{})
- func (l *Logger) FatalContext(ctx context.Context, i ...interface{})
- func (l *Logger) Fatalf(format string, i ...interface{})
- func (l *Logger) Info(i ...interface{})
- func (l *Logger) InfoContext(ctx context.Context, format string, i ...interface{})
- func (l *Logger) Infof(format string, i ...interface{})
- func (l *Logger) Level() Level
- func (l *Logger) Log(ctx context.Context, level Level, args ...interface{})
- func (l *Logger) Logf(ctx context.Context, level Level, format string, args ...interface{})
- func (l *Logger) NoSendDebug()
- func (l *Logger) NoSendError()
- func (l *Logger) NoSendFatal()
- func (l *Logger) NoSendInfo()
- func (l *Logger) NoSendPanic()
- func (l *Logger) NoSendWarn()
- func (l *Logger) NoSendWebhook()
- func (l *Logger) Panic(i ...interface{})
- func (l *Logger) PanicContext(ctx context.Context, i ...interface{})
- func (l *Logger) Panicf(format string, i ...interface{})
- func (l *Logger) SetDebugWebhook(webhook string)
- func (l *Logger) SetErrorWebhook(webhook string)
- func (l *Logger) SetFatalWebhook(webhook string)
- func (l *Logger) SetInfoWebhook(webhook string)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetPanicWebhook(webhook string)
- func (l *Logger) SetSendLevel(level Level)
- func (l *Logger) SetWarnWebhook(webhook string)
- func (l *Logger) SetWebhook(webhook string)
- func (l *Logger) Warn(i ...interface{})
- func (l *Logger) WarnContext(ctx context.Context, i ...interface{})
- func (l *Logger) Warnf(format string, i ...interface{})
- func (l *Logger) Webhook() string
- type Option
- type Slack
- func (s *Slack) DebugWebhook() string
- func (s *Slack) ErrorWebhook() string
- func (s *Slack) FatalWebhook() string
- func (s *Slack) InfoWebhook() string
- func (s *Slack) PanicWebhook() string
- func (s *Slack) SetDebugWebhook(webhook string)
- func (s *Slack) SetErrorWebhook(webhook string)
- func (s *Slack) SetFatalWebhook(webhook string)
- func (s *Slack) SetInfoWebhook(webhook string)
- func (s *Slack) SetPanicWebhook(webhook string)
- func (s *Slack) SetWarnWebhook(webhook string)
- func (s *Slack) SetWebhook(webhook string)
- func (s *Slack) WarnWebhook() string
- func (s *Slack) Webhook() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discord ¶
type Discord struct {
// contains filtered or unexported fields
}
This structure Discord holds the webhook url for logging to discord.
func NewDiscord ¶
func (*Discord) DebugWebhook ¶
func (*Discord) ErrorWebhook ¶
func (*Discord) FatalWebhook ¶
func (*Discord) InfoWebhook ¶
func (*Discord) PanicWebhook ¶
func (*Discord) SetDebugWebhook ¶
Set the webhookurl for the Debug level.
func (*Discord) SetErrorWebhook ¶
Set the webhookurl for the Error level.
func (*Discord) SetFatalWebhook ¶
Set the webhookurl for the Fatal level.
func (*Discord) SetInfoWebhook ¶
Set the webhookurl for the Info level.
func (*Discord) SetPanicWebhook ¶
Set the webhookurl for the Panic level.
func (*Discord) SetWarnWebhook ¶
Set the webhookurl for the Warn level.
func (*Discord) SetWebhook ¶
Sets the webhook url. This url will be used if the webhook url for any level is not set
func (*Discord) WarnWebhook ¶
type Level ¶
type Level uint32
Level is a logging priority. Higher levels are more important.
const ( // Debug level logs are used for debugging DebugLevel Level = iota // Info level logs are logs at a lower level and are used to preserve information. InfoLevel // Warn level is a higher level of logging than Info level // and is usually used to output more important logs than the info log. WarnLevel // Error level is a higher level of logging and is usually used to output a log of errors ErrorLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
func ParseLevel ¶
func (Level) MarshalText ¶
func (*Level) UnmarshalText ¶
Converts the string representing level to level. Returns an error if the level is not expected
func (Level) UppercaseString ¶
type Logger ¶
type Logger struct {
Types Option
Slack *Slack
Discord *Discord
SendLevel Level
// This is the url of the icon image of the bot that sends notifications to the discord
// ex) https://cdn-ak.f.st-hatena.com/images/fotolife/h/hikiniku0115/20190806/20190806000644.png
Img string
// This is the name of the bot that will send notifications to the discord
// ex) hogehoge
Name string
// contains filtered or unexported fields
}
This structure defines what is needed to output logs to any channel on discord or slack.
func (*Logger) DebugContext ¶ added in v0.1.9
func (*Logger) ErrorContext ¶ added in v0.1.9
func (*Logger) FatalContext ¶ added in v0.1.9
func (*Logger) InfoContext ¶ added in v0.1.9
func (*Logger) NoSendDebug ¶
func (l *Logger) NoSendDebug()
func (*Logger) NoSendError ¶
func (l *Logger) NoSendError()
func (*Logger) NoSendFatal ¶
func (l *Logger) NoSendFatal()
func (*Logger) NoSendInfo ¶
func (l *Logger) NoSendInfo()
func (*Logger) NoSendPanic ¶
func (l *Logger) NoSendPanic()
func (*Logger) NoSendWarn ¶
func (l *Logger) NoSendWarn()
func (*Logger) PanicContext ¶ added in v0.1.9
func (*Logger) SetDebugWebhook ¶
func (*Logger) SetErrorWebhook ¶
func (*Logger) SetFatalWebhook ¶
func (*Logger) SetInfoWebhook ¶
func (*Logger) SetPanicWebhook ¶
func (*Logger) SetSendLevel ¶ added in v0.2.0
func (*Logger) SetWarnWebhook ¶
func (*Logger) SetWebhook ¶
Sets the specified url in the webhook for each level
func (*Logger) WarnContext ¶ added in v0.1.9
type Option ¶ added in v0.3.0
type Option struct {
// contains filtered or unexported fields
}
Option is a type of structure that holds types such as slack, discord, etc. You can freely customize this when you want to notify a different service in slack, discord, etc.
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
This structure slack holds the webhook url for logging to slack. This webhook assumes that the Incoming Webhook is used.
func (*Slack) DebugWebhook ¶
func (*Slack) ErrorWebhook ¶
func (*Slack) FatalWebhook ¶
func (*Slack) InfoWebhook ¶
func (*Slack) PanicWebhook ¶
func (*Slack) SetDebugWebhook ¶
Set the webhookurl for the Debug level.
func (*Slack) SetErrorWebhook ¶
Set the webhookurl for the Error level.
func (*Slack) SetFatalWebhook ¶
Set the webhookurl for the Fatal level.
func (*Slack) SetInfoWebhook ¶
Set the webhookurl for the Info level.
func (*Slack) SetPanicWebhook ¶
Set the webhookurl for the Panic level.
func (*Slack) SetWarnWebhook ¶
Set the webhookurl for the Warn level.
func (*Slack) SetWebhook ¶
Sets the webhook url. This url will be used if the webhook url for any level is not set