Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MultiMessageSeparator = []byte("\n\n================================================================================\n\n")
MultiMessageSeparator used in WriteTo function in the message slice type to separate between multiple messages in a log file.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct { // MailDir writes mails into this directory. If set to "stderr" or "stdout" // then the output will be forwarded to those ports. MailDir string // ErrDir writes error log file into this directory. If set to "stderr" or // "stdout" then the output will be forwarded to those ports. ErrDir string // ErrFile full file path to the error log file ErrFile string // contains filtered or unexported fields }
Logger logs emails and errors. If nil, nothing gets logged.
func New ¶
New creates a new logger by a given directory. If the directory does not exists it will be created recursively. Empty directory means a valid nil logger.
func (Logger) Errorf ¶
Errorf writes into the error log file. If the logger is nil no writes will happen.
func (Logger) NewWriter ¶
func (l Logger) NewWriter() io.WriteCloser
NewWriter creates a new file with a file name consisting of a time stamp. If it fails to create a file it returns a nilWriteCloser and does not log anymore any data. Guaranteed to not return nil.
Click to show internal directories.
Click to hide internal directories.