Skip to content

v0.5.0: Support new Log module on Crystal 0.34.0.

Pre-release
Pre-release

Choose a tag to compare

@arcage arcage released this 12 Apr 14:09
· 33 commits to master since this release
f77b954
  • (breaking change) Replace logger property(old Logger type) on EMail::Client::Config class to log property(new Log type).
    The new one is used as the client specific logger.
    The logger : Logger named argument of EMail::Client::Config.create method is replaced to the log : Log too.

  • (breaking change) Remove log_*** named arguments from EMail::Client::Config.create

  • Add .log class method to EMail::Clinet.
    This returns the default logger.

  • Add .log_level=, .log_io=, .log_formatter= class methods to EMail::Clinet.
    These change behavior of the default logger.

  • (breaking change) Default on_fatal_error handler never exit the program, just re-raise the exception raised during the SMTP session.
    In almost cases, the program will be stoped by the unhandled exception.
    But, you may need to exit the program explicitly in some cases.

New logging behavior

You can use two kinds of logger(Log type objects), the default logger and the client specific logger.

The default logger is declared on the EMail::Client type. It can be got by EMail::Client.log, and change its behavior by EMail::Client.log_***= methods.

On the other hand, the client specific logger will be set to EMail::Client instance itself by EMail::Client::Config setting. With this, you can use your own logger for the EMail::Client object.

If the EMail::Client object has the client specific logger, the client use it to output the log entries. Otherwise, the client use the default logger.