wneessen / go-mail

📧 Easy to use, yet comprehensive library for sending mails with Go
https://go-mail.dev
MIT License
679 stars 48 forks source link

Evaluate using a logger interface instead of golang stdlib log package #112

Closed wneessen closed 1 year ago

wneessen commented 1 year ago

Is your feature request related to a problem? Please describe.

As stated in https://github.com/wneessen/go-mail/pull/102#issuecomment-1411956040, we should rather use a logger intreface, so the user can decide which kind of logger they want to use.

Describe the solution you'd like

We provide a simple Logger interface that can be implemented easily:

type Logger interface {
    Errorf(format string, v ...interface{})
    Warnf(format string, v ...interface{})
    Infof(format string, v ...interface{})
    Debugf(format string, v ...interface{})
}

Describe alternatives you've considered

No response

Additional context

No response

james-d-elliott commented 1 year ago

Theoretically multiple can be supported relatively easily using the method described in the comment. As users can just provide a decorator that implements the Logger for their particular logging provider. So overall this is a really nice idea (I did think of it when I saw it but forgot to post due to being busy lol!).