I need a logger to support print messages to console or some string to output, but the Log class in this package can't do(or I will write to a text file and read it). I think you'd better provide a interface such as ISmtpLogger, and implemented by users who want it, the interface can include Write(), WriteLine(), etc(just like System.IO.TextWriter). By default you can implement a TextLogger to output messages to a text file just like the Log class. Then put a ISmtpLogger field in Smtp class(not static) and LogMessage just call the field's WriteLine() or other method, I can easily print messages to console just provide a ISmtpLogger and change the logger field.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is also another good suggestion. I've been thinking about this myself and wanted to add not only console support but also Event Log capabilities. The log class was ill designed because I never really intended to use it publically. Not very well thought out in my opinion.
Let me look at the code tonight and get back to you with any changes I intend to make. Thanks for your input again Weber, it is appreciated :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need a logger to support print messages to console or some string to output, but the Log class in this package can't do(or I will write to a text file and read it). I think you'd better provide a interface such as ISmtpLogger, and implemented by users who want it, the interface can include Write(), WriteLine(), etc(just like System.IO.TextWriter). By default you can implement a TextLogger to output messages to a text file just like the Log class. Then put a ISmtpLogger field in Smtp class(not static) and LogMessage just call the field's WriteLine() or other method, I can easily print messages to console just provide a ISmtpLogger and change the logger field.
This is also another good suggestion. I've been thinking about this myself and wanted to add not only console support but also Event Log capabilities. The log class was ill designed because I never really intended to use it publically. Not very well thought out in my opinion.
Let me look at the code tonight and get back to you with any changes I intend to make. Thanks for your input again Weber, it is appreciated :)