lewster32 / corporallancot

A Discord bot primarily for recording, searching and retrieving notes and quotes
MIT License
1 stars 2 forks source link

Abstract logging #4

Open Bidthedog opened 4 years ago

Bidthedog commented 4 years ago

console.log needs to be abstracted and replaced with a logging class. I have already done this and it will be in my next PR:

'use strict';

module.exports = class Logger {
  constructor() {
  }

  async log(message, params) {
    if (params) {
      console.log(message, params);
    } else {
      console.log(message);
    }
  }
}

This is injected into all of the services and classes with Awilix.

However, as you can see the logging class still logs to console.log at present - this needs to be replaced with something like Winston with rolling log expiry. This can be done once the IoC / DI has been PR'd.