Simple multipurpose logger

Fork of LogIt by Nico De Witte

logable.h

Committer:
Nico De Witte
Date:
2016-12-15
Revision:
6:17bc740828b8
Parent:
4:9c5143891c8a
Child:
7:eb101b1726a5

File content as of revision 6:17bc740828b8:

#pragma once

#include "null_logger.h"

// Allow your classes to easily log by implementing Logable

namespace LogIt {

  class Logable
  {
    protected:
      Log::LoggerInterface * logger;

    public:
      Logable(void) {
        this->logger = NullLogger::get_instance();
      }

      void set_logger(Log::LoggerInterface * logger = 0) {
        if (logger == 0) {
          this->logger = NullLogger::get_instance();
        } else {
          this->logger = logger;
        }
      }
  };

};