Current required packages for Debian/Ubuntu
[rofl0r-conpix.git] / Logger.cpp
blob3e76d6a78b2e357d1920c05dab6ff7c729d1da29
1 /*
2 * Logger.cpp
4 * Created on: 05.12.2010
5 * Author: rofl
6 */
8 #include <iostream>
9 #include <fstream>
11 #include "Logger.h"
13 using namespace std;
15 void ILogger::log(string s) {
18 void ILogger::logln(string s){
22 void SimpleConsoleLogger::log(string s) {
23 cout << s;
26 void SimpleConsoleLogger::logln(string s){
27 cout << s << endl;
30 SimpleFileLogger::SimpleFileLogger(string out_file) {
31 outfile = out_file;
32 myfile.open (outfile.c_str(), ios::out | ios::app | ios::binary);
35 SimpleFileLogger::~SimpleFileLogger() {
36 myfile.close();
38 void SimpleFileLogger::logln(string s) {
39 log(s);
40 log("\n");
43 void SimpleFileLogger::log(string s) {
44 myfile << s;
48 virtual void log(void* buf, size_t bufsize){
49 string mybuf;
50 mybuf.length = bufsize;
51 memcpy(mybuf.ptr, buf, bufsize);
52 myfile.write(mybuf);
55 void SimpleFileLogger::clear() {
56 myfile.close();
57 myfile.open (outfile.c_str(), ios::out | ios::trunc | ios::binary);
58 //myfile = new File(outfile, File.WriteCreate);