Logging

The logger component provides logging for the Areto framework. It is created as an instance of the areto/log/Logger class.

Add the logger component in the application configuration.   Usually the logger is placed on the first place among components.

config/default.js

module.exports = {
  ...
  components: {
    'logger': {
      level: 'info'
    }
    ...
  }
};

The level property contains maximum level of stored logs.

Typical levels of logging: trace, debug, info, warning, error, fatal. Each level includes all following ones. For example, if you set the info level, then a log will be kept with following types: info, warning, error, fatal. And if you set the trace level, it will be stored in general, all logs.

The optimal level for development is trace. It is set in the development configuration file.

config/development.js

module.exports = {
  ...
  components: {
    'logger': {
      level: 'trace'
    }
    ...
  }
};

By default, the logs are stored as text files to the log directory of the project root and are displayed in server console. Log rotation occurs when file size reaches limit (default is 2 Mb).