Toll free (US) : +1 (888) 838-3532 | NYC: +1 (646) 491-6866

The Logger class, as the name suggests provides Logging functionality to jot down important points that you can use to output different kind of messages.
The messages can be of different severities aka levels;

LEVEL SUMMARY
UNKNOWN Unknown messages are the unexpected or random messages and they should always be logged.
FATAL An error that was not handled and could lead to program crashing
ERROR An error that can be handled
WARN A warning
INFO Generic information about the usage from the code being executed
DEBUG Information that was deduced during debugging

The order goes like;
debug < info < warn < error < fatal < unknown

They work as;
In production mode, you can set-up your Logger to output the messages which are either INFO messages or of the WARN level.
While in development mode, you would want to keep a tab on the program’s state and its status and therefore, you can set the Logger to the DEBUG level.

The interface is normally used as follows;

You also have the option to set an expiration date to the Log file. For ex, I want to keep the logs only for the current month. In that case I will be proceeding as follows:

And on an application level,

Happy logging !

Signing out,
Niyanta

Niyanta Zamindar
Ruby on Rails Developer
footer-icon

Pin It on Pinterest

Share This