|
@@ -8,23 +8,20 @@ type SMTPClient interface {
|
|
|
|
|
|
type Config struct {
|
|
type Config struct {
|
|
// stdout config
|
|
// stdout config
|
|
- stdoutLogEnabled bool
|
|
|
|
- stdoutLogLevel slog.Level // INFO by default
|
|
|
|
- stdoutLogAddSource bool
|
|
|
|
|
|
+ stdoutLogEnabled bool
|
|
|
|
+ stdoutLogLevel slog.Level // INFO by default
|
|
|
|
|
|
// file config
|
|
// file config
|
|
- fileLogEnabled bool
|
|
|
|
- fileLogLevel slog.Level // INFO by default
|
|
|
|
- fileLogAddSource bool
|
|
|
|
- filepath string
|
|
|
|
|
|
+ fileLogEnabled bool
|
|
|
|
+ fileLogLevel slog.Level // INFO by default
|
|
|
|
+ filepath string
|
|
|
|
|
|
// email config
|
|
// email config
|
|
- emailLogEnabled bool
|
|
|
|
- emailLogLevel slog.Level // INFO by default
|
|
|
|
- emailLogAddSource bool
|
|
|
|
- smtpClient SMTPClient
|
|
|
|
- emailRecipient string
|
|
|
|
- emailSubject string
|
|
|
|
|
|
+ emailLogEnabled bool
|
|
|
|
+ emailLogLevel slog.Level // INFO by default
|
|
|
|
+ smtpClient SMTPClient
|
|
|
|
+ emailRecipient string
|
|
|
|
+ emailSubject string
|
|
}
|
|
}
|
|
|
|
|
|
type ConfigOption func(*Config)
|
|
type ConfigOption func(*Config)
|
|
@@ -60,11 +57,6 @@ func WithStdoutLogLevel(level string) ConfigOption {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-func WithStdoutLogAddSource(add bool) ConfigOption {
|
|
|
|
- return func(s *Config) {
|
|
|
|
- s.stdoutLogAddSource = add
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
|
|
// file
|
|
// file
|
|
|
|
|
|
@@ -83,12 +75,6 @@ func WithFileLogLevel(level string) ConfigOption {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-func WithFileLogAddSource(add bool) ConfigOption {
|
|
|
|
- return func(s *Config) {
|
|
|
|
- s.fileLogAddSource = add
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func WithFilepath(path string) ConfigOption {
|
|
func WithFilepath(path string) ConfigOption {
|
|
return func(s *Config) {
|
|
return func(s *Config) {
|
|
s.filepath = path
|
|
s.filepath = path
|
|
@@ -112,12 +98,6 @@ func WithEmailLogLevel(level string) ConfigOption {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-func WithEmailLogAddSource(add bool) ConfigOption {
|
|
|
|
- return func(s *Config) {
|
|
|
|
- s.emailLogAddSource = add
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func WithEmailRecipient(email string) ConfigOption {
|
|
func WithEmailRecipient(email string) ConfigOption {
|
|
return func(s *Config) {
|
|
return func(s *Config) {
|
|
s.emailRecipient = email
|
|
s.emailRecipient = email
|