feisty meow concerns codebase
2.140
combo_logger.h
Go to the documentation of this file.
1
#ifndef COMBO_LOGGER_CLASS
2
#define COMBO_LOGGER_CLASS
3
4
/*****************************************************************************\
5
* *
6
* Name : combo_logger
7
* Author : Chris Koeritz
8
* *
9
*******************************************************************************
10
* Copyright (c) 2000-$now By Author. This program is free software; you can *
11
* redistribute it and/or modify it under the terms of the GNU General Public *
12
* License as published by the Free Software Foundation; either version 2 of *
13
* the License or (at your option) any later version. This is online at: *
14
* http://www.fsf.org/copyleft/gpl.html *
15
* Please send any updates to: fred@gruntose.com *
16
\*****************************************************************************/
17
18
#include "
file_logger.h
"
19
20
namespace
loggers
{
21
23
26
class
combo_logger
:
public
virtual
file_logger
,
public
virtual
console_logger
27
{
28
public
:
29
combo_logger
(
const
basis::astring
&filename,
30
int
limit
=
DEFAULT_LOG_FILE_SIZE
,
31
stream_choices
log_target =
TO_STDOUT
);
32
33
virtual
~combo_logger
() {}
34
35
DEFINE_CLASS_NAME
(
"combo_logger"
);
36
37
virtual
basis::outcome
log
(
const
basis::base_string
&info,
int
filter = basis::ALWAYS_PRINT);
38
39
// overrides that enforce properties for both loggers.
40
virtual
void
add_filter
(
int
new_filter);
41
virtual
void
remove_filter
(
int
old_filter);
42
virtual
void
clear_filters
();
43
virtual
void
eol
(
textual::parser_bits::line_ending
to_set);
44
};
45
47
49
#define SETUP_COMBO_LOGGER { \
50
basis::base_logger *old_log = program_wide_logger::set \
51
(new loggers::combo_logger \
52
(loggers::file_logger::log_file_for_app_name())); \
53
WHACK(old_log); \
54
}
55
56
}
//namespace.
57
58
#endif
59
basis::astring
Provides a dynamically resizable ASCII character string.
Definition:
astring.h:35
basis::base_string
Defines the base class for all string processing objects in hoople.
Definition:
base_string.h:28
basis::outcome
Outcomes describe the state of completion for an operation.
Definition:
outcome.h:31
loggers::combo_logger
combines a file_logger with a console logger, behaving like the 'tee' command.
Definition:
combo_logger.h:27
loggers::combo_logger::add_filter
virtual void add_filter(int new_filter)
Adds a member to the filter set.
Definition:
combo_logger.cpp:55
loggers::combo_logger::combo_logger
combo_logger(const basis::astring &filename, int limit=DEFAULT_LOG_FILE_SIZE, stream_choices log_target=TO_STDOUT)
Definition:
combo_logger.cpp:49
loggers::combo_logger::remove_filter
virtual void remove_filter(int old_filter)
Removes a member from the filter set.
Definition:
combo_logger.cpp:61
loggers::combo_logger::log
virtual basis::outcome log(const basis::base_string &info, int filter=basis::ALWAYS_PRINT)
sends the string "info" to the standard output device.
Definition:
combo_logger.cpp:79
loggers::combo_logger::clear_filters
virtual void clear_filters()
Resets the filter set to be empty.
Definition:
combo_logger.cpp:67
loggers::combo_logger::DEFINE_CLASS_NAME
DEFINE_CLASS_NAME("combo_logger")
loggers::combo_logger::~combo_logger
virtual ~combo_logger()
Definition:
combo_logger.h:33
loggers::console_logger
Definition:
console_logger.h:33
loggers::console_logger::stream_choices
stream_choices
Definition:
console_logger.h:35
loggers::console_logger::TO_STDOUT
@ TO_STDOUT
Definition:
console_logger.h:35
loggers::eol_aware::eol
virtual textual::parser_bits::line_ending eol()
observes how line endings are to be printed.
Definition:
eol_aware.h:34
loggers::file_logger
Definition:
file_logger.h:38
loggers::file_logger::DEFAULT_LOG_FILE_SIZE
@ DEFAULT_LOG_FILE_SIZE
this just defines the default for the log file size.
Definition:
file_logger.h:55
loggers::file_logger::limit
int limit() const
observes the allowable size of the log file.
Definition:
file_logger.h:87
textual::parser_bits::line_ending
line_ending
Line endings is an enumeration of the separator character(s) used for text files.
Definition:
parser_bits.h:31
file_logger.h
loggers
A logger that sends to the console screen using the standard output device.
Definition:
combo_logger.cpp:36
nucleus
library
loggers
combo_logger.h
Generated by
1.9.1