WvStreams
debian/libwvstreams-dev/usr/include/wvstreams/wvcolorlogconsole.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * A version of WvLogConsole that colorizes output on terminals
6 * which support ANSI color sequences
7 */
8#ifndef __WVCOLORLOGCONSOLE_H
9#define __WVCOLORLOGCONSOLE_H
10
11#include "wvlogrcv.h"
12
18{
19 bool colorize;
20
21public:
22 WvColorLogConsole(int _fd,
23 WvLog::LogLevel _max_level = WvLog::NUM_LOGLEVELS);
24 virtual ~WvColorLogConsole();
25
26 static bool is_tty(int fd);
27 static bool can_colorize(int fd, const char *TERM);
28
29 static const char *color_start_seq(WvLog::LogLevel log_level);
30 static const char *clear_to_eol_seq(WvLog::LogLevel log_level);
31 static const char *color_end_seq(WvLog::LogLevel log_level);
32
33protected:
34 virtual void _begin_line();
35 virtual void _mid_line(const char *str, size_t len);
36 virtual void _end_line();
37};
38
39#endif // __WVCOLORLOGCONSOLE_H
WvLogRcv adds some intelligence to WvLogRcvBase, to keep track of line-prefix-printing and other form...
virtual void _begin_line()
Start a new log line (print prefix)
virtual void _mid_line(const char *str, size_t len)
add text to the current log line.
virtual void _end_line()
End this (Guaranteed NonEmpty) log line.
Captures formatted log messages and outputs them to the specified file descriptor.