view OrthancServer/Resources/Samples/CppHelpers/Logging/NullLogger.h @ 4244:416c35da7d25

robustness against non-dicom files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Oct 2020 10:38:45 +0200
parents d25f4c0fa160
children c847b0dfd255
line wrap: on
line source

#pragma once

#include "ILogger.h"

namespace OrthancHelpers
{
  // a logger ... that does not log.
  // Instead of writing:
  // if (logger != NULL)
  // {
  //   logger->Info("hello")   ;
  // }
  // you should create a NullLogger:
  // logger = new NullLogger();
  // ...
  // logger->Info("hello");
  class NullLogger : public BaseLogger {
  public:
    NullLogger() {}

    virtual void Trace(const char* message) {}
    virtual void Trace(const std::string& message) {}
    virtual void Info(const char* message) {}
    virtual void Info(const std::string& message) {}
    virtual void Warning(const char* message) {}
    virtual void Warning(const std::string& message) {}
    virtual void Error(const char* message) {}
    virtual void Error(const std::string& message) {}
  };
}