wmi

git clone git://oldgit.suckless.org/wmi/
Log | Files | Refs | LICENSE

logger.cpp (686B)


      1 // Copyright (c) 2003 - 2009 Anselm R Garbe <anselm@garbe.us>
      2 // See LICENSE for license details.
      3 
      4 extern "C" {
      5 #include <stdlib.h>
      6 }
      7 
      8 #include <iostream>
      9 
     10 #include "logger.h"
     11 #include "util.h"
     12 
     13 Logger::Logger() {
     14 
     15 }
     16 
     17 Logger::~Logger() {
     18 
     19 }
     20 
     21 void Logger::error(string message, bool fatal) {
     22     cerr << "wmi[E " << Util::timestamp() << "]: " << message;
     23     if (fatal) {
     24         cerr << ", giving up" << endl;
     25         exit(1);
     26     }
     27     cerr << endl;
     28 }
     29 
     30 void Logger::warning(string message) {
     31     cerr << "wmi[W " << Util::timestamp() << "]: " << message << endl;
     32 }
     33 
     34 void Logger::debug(string message) {
     35     cout << "wmi[D " << Util::timestamp() << "]: "
     36          << message << endl;
     37 }