first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / loggers / console_logger.cpp
1 /*****************************************************************************\
2 *                                                                             *
3 *  Name   : console_logger                                                    *
4 *  Author : Chris Koeritz                                                     *
5 *                                                                             *
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 \*****************************************************************************/
14
15 #include "console_logger.h"
16 #include "logging_filters.h"
17
18 #include <stdio.h>
19
20 using namespace basis;
21
22 namespace loggers {
23
24 console_logger::console_logger(stream_choices target) : c_target(target)
25 {}
26
27 console_logger::~console_logger() {}
28
29 outcome console_logger::log(const base_string &info, int filter)
30 {
31
32 if (filter) {} //temp ignored
33
34   FILE *log_to = stdout;
35   if (c_target == TO_STDERR) log_to = stderr;
36
37 //hmmm: temp simplified form during bootup of new hoople.
38 fprintf(log_to, "%s\n", (char *)info.observe());
39
40 /*
41 hmmm: need filter set support!
42   if (member(filter)) {
43 */
44     // format the output with %s to ensure we get all characters, rather
45     // than having some get interpreted if we used info as the format spec.
46 //    fprintf(log_to, "%s", (char *)info.s());
47     // send the EOL char if the style is appropriate for that.
48 //    if (eol() != NO_ENDING) fprintf(log_to, "%s", get_ending().s());
49
50
51     // write immediately to avoid lost output on crash.
52     fflush(log_to);
53
54 /*
55 hmmm: need filter set support!
56   }
57 */
58   return common::OKAY;
59 }
60
61 } //namespace.
62
63