libassa 3.5.1
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
ASSA::StdOutLogger Class Reference

#include <StdOutLogger.h>

Inheritance diagram for ASSA::StdOutLogger:
ASSA::Logger_Impl

Public Member Functions

 StdOutLogger ()
 
virtual int log_open (u_long groups_)
 Open StdErr Logger.
 
virtual int log_close (void)
 
virtual int log_msg (Group g_, size_t indent_level_, const string &func_name_, size_t expected_sz_, const char *fmt_, va_list)
 
virtual int log_func (Group g_, size_t indent_level_, const string &func_name_, marker_t type_)
 
virtual void log_resync ()
 
- Public Member Functions inherited from ASSA::Logger_Impl
 Logger_Impl ()
 
virtual ~Logger_Impl ()
 
void enable_group (Group g_)
 
void disable_group (Group g_)
 
void enable_groups (u_long g_)
 
void disable_groups (u_long g_)
 
void enable_all_groups (void)
 
void disable_all_groups (void)
 
bool group_enabled (Group g_) const
 
void enable_timestamp (void)
 
void disable_timestamp (void)
 
bool timestamp_enabled (void) const
 
void set_timezone (int zone_)
 
void set_indent_step (u_short step_)
 
u_short get_indent_step (void) const
 
virtual int log_open (const char *logfname_, u_long groups_, u_long maxsize_)
 Open File Logger.
 
virtual int log_open (const char *appname_, const char *logfname_, u_long groups_, u_long maxsize_, Reactor *reactor_)
 Open connection with Log Server.
 

Private Member Functions

 StdOutLogger (const StdOutLogger &)
 
StdOutLoggeroperator= (const StdOutLogger &)
 no cloning
 

Additional Inherited Members

- Static Public Attributes inherited from ASSA::Logger_Impl
static const unsigned int LOGGER_MAXLINE = 6660
 Maximum length of the formatted message.
 
- Protected Member Functions inherited from ASSA::Logger_Impl
virtual u_short add_timestamp (ostream &sink_)
 
virtual u_short indent_func_name (ostream &sink_, const string &funcname_, size_t indent_level_, marker_t type_)
 
charformat_msg (size_t expected_sz_, const char *fmt_, va_list vap_, bool &release_)
 Format and put the message in the buffer.
 
- Protected Attributes inherited from ASSA::Logger_Impl
u_short m_indent_step
 Indentation step.
 
u_long m_groups
 Enabled groups.
 
string m_logfname
 Log file name.
 
bool m_tmflg
 Timestamp on/off flag.
 
int m_tz
 Timezone: 0-GMT, 1-Local.
 
- Static Protected Attributes inherited from ASSA::Logger_Impl
static char m_msgbuf [LOGGER_MAXLINE]
 Static buffer for formatted message.
 

Detailed Description

Definition at line 32 of file StdOutLogger.h.

Constructor & Destructor Documentation

◆ StdOutLogger() [1/2]

ASSA::StdOutLogger::StdOutLogger ( )
inline

Definition at line 35 of file StdOutLogger.h.

35{ /*empty*/ }

◆ StdOutLogger() [2/2]

ASSA::StdOutLogger::StdOutLogger ( const StdOutLogger )
private

Member Function Documentation

◆ log_close()

int ASSA::StdOutLogger::log_close ( void  )
inlinevirtual

Implements ASSA::Logger_Impl.

Definition at line 69 of file StdOutLogger.h.

71{
72 return 0;
73}

◆ log_func()

int StdOutLogger::log_func ( Group  g_,
size_t  indent_level_,
const string &  func_name_,
marker_t  type_ 
)
virtual

Implements ASSA::Logger_Impl.

Definition at line 59 of file StdOutLogger.cpp.

64{
65 if (! group_enabled (g_)) {
66 return 0;
67 }
68
69 add_timestamp (std::cerr);
71
72 if (type_ == FUNC_ENTRY) {
73 std::cout << "---v---\n";
74 }
75 else if (type_ == FUNC_EXIT) {
76 std::cout << "---^---\n";
77 }
78
79 return 0;
80}
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
virtual u_short indent_func_name(ostream &sink_, const string &funcname_, size_t indent_level_, marker_t type_)
bool group_enabled(Group g_) const
virtual u_short add_timestamp(ostream &sink_)
@ FUNC_ENTRY
Definition LogMask.h:69
@ FUNC_EXIT
Definition LogMask.h:70

References ASSA::Logger_Impl::add_timestamp(), ASSA::FUNC_ENTRY, ASSA::FUNC_EXIT, ASSA::Logger_Impl::group_enabled(), and ASSA::Logger_Impl::indent_func_name().

◆ log_msg()

int StdOutLogger::log_msg ( Group  g_,
size_t  indent_level_,
const string &  func_name_,
size_t  expected_sz_,
const char fmt_,
va_list  msg_list_ 
)
virtual

Implements ASSA::Logger_Impl.

Definition at line 27 of file StdOutLogger.cpp.

34{
35 bool release = false;
36 char* msgbuf_ptr = NULL;
37
38 if (! group_enabled (g_)) {
39 return 0;
40 }
41
42 add_timestamp (std::cerr);
44
46
47 if (msgbuf_ptr == NULL) {
48 return -1; // failed to format
49 }
50 std::cout << msgbuf_ptr;
51
52 if (release) {
53 delete [] msgbuf_ptr;
54 }
55 return 0;
56}
char * format_msg(size_t expected_sz_, const char *fmt_, va_list vap_, bool &release_)
Format and put the message in the buffer.
@ FUNC_MSG
Definition LogMask.h:68

References ASSA::Logger_Impl::add_timestamp(), ASSA::Logger_Impl::format_msg(), ASSA::FUNC_MSG, ASSA::Logger_Impl::group_enabled(), and ASSA::Logger_Impl::indent_func_name().

◆ log_open()

int ASSA::StdOutLogger::log_open ( u_long  groups_)
inlinevirtual

Open StdErr Logger.

Reimplemented from ASSA::Logger_Impl.

Definition at line 61 of file StdOutLogger.h.

63{
64 m_groups = groups_;
65 return 0;
66}
u_long m_groups
Enabled groups.

References ASSA::Logger_Impl::m_groups.

◆ log_resync()

void ASSA::StdOutLogger::log_resync ( void  )
inlinevirtual

Reimplemented from ASSA::Logger_Impl.

Definition at line 76 of file StdOutLogger.h.

78{
79 std::cout << std::flush;
80}

◆ operator=()

StdOutLogger & ASSA::StdOutLogger::operator= ( const StdOutLogger )
private

no cloning


The documentation for this class was generated from the following files: