Skip to content
Repos

DevPlaceApp

C++ 624 B19 lines Opens in site

Directory Raw Download

#pragma once
// Spec: SPEC.md OPS-01 (logging). stderr plus rotating file, never unbounded, never secrets.
#include <string>

namespace dp {

class Log {
 public:
  enum class Level { Debug, Info, Warn, Error };

  static void init(const std::string& directory);
  static void write(Level level, const std::string& message);
  static void debug(const std::string& m) { write(Level::Debug, m); }
  static void info(const std::string& m) { write(Level::Info, m); }
  static void warn(const std::string& m) { write(Level::Warn, m); }
  static void error(const std::string& m) { write(Level::Error, m); }
};

}  // namespace dp
33.6ms