1 /*****************************************************************************\
4 * Author : Chris Koeritz
6 *******************************************************************************
7 * Copyright (c) 2000-$now By Author. This program is free software; you can *
8 * redistribute it and/or modify it under the terms of the GNU General Public *
9 * License as published by the Free Software Foundation; either version 2 of *
10 * the License or (at your option) any later version. This is online at: *
11 * http://www.fsf.org/copyleft/gpl.html *
12 * Please send any updates to: fred@gruntose.com *
13 \*****************************************************************************/
15 #include "combo_logger.h"
17 #include <filesystem/directory.h>
18 #include <filesystem/filename.h>
19 #include <mathematics/chaos.h>
20 #include <structures/static_memory_gremlin.h>
21 #include <textual/parser_bits.h>
31 using namespace basis;
32 using namespace filesystem;
33 using namespace structures;
34 using namespace textual;
38 //const int REDUCE_FACTOR = 5;
39 // we whack this portion of the file every time we truncate. if it's set
40 // to 14, for example, then a 14th of the file is whacked every time whacking
43 //const int MAXIMUM_BUFFER_SIZE = 140000;
44 // the maximum allowed chunk that can be copied from the old logfile
45 // to the current one.
47 //int static_chaos() { return chaos().inclusive(0, 1280004); }
49 combo_logger::combo_logger(const astring &filename, int limit, stream_choices target)
50 : file_logger(filename, limit),
51 console_logger(target)
55 void combo_logger::add_filter(int new_filter)
57 file_logger::add_filter(new_filter);
58 console_logger::add_filter(new_filter);
61 void combo_logger::remove_filter(int old_filter)
63 file_logger::remove_filter(old_filter);
64 console_logger::remove_filter(old_filter);
67 void combo_logger::clear_filters()
69 file_logger::clear_filters();
70 console_logger::clear_filters();
73 void combo_logger::eol(textual::parser_bits::line_ending to_set)
75 file_logger::eol(to_set);
76 console_logger::eol(to_set);
79 outcome combo_logger::log(const base_string &info, int filter)
81 console_logger::log(info, filter);
82 return file_logger::log(info, filter);