3 //=============================================================================
7 * @author Marina Spivak <marina@cs.wustl.edu>
8 * @author Sergio Flores-Gaitan <sergio@cs.wustl.edu>
9 * @author and Matthew Braun <mjb2@cec.wustl.edu>
11 //=============================================================================
14 #ifndef TAO_ORBSVCS_LOGGER_I_H
15 #define TAO_ORBSVCS_LOGGER_I_H
18 #include "ace/Hash_Map_Manager.h"
19 #include "ace/SString.h"
20 #include "ace/Null_Mutex.h"
25 * @brief Used to log messages to a logging server.
27 class Logger_i
: public virtual POA_Logger
31 Logger_i (const char* name
);
34 virtual ~Logger_i (void);
36 /// Writes the <log_rec> to the standard output.
37 virtual void log (const Logger::Log_Record
&log_rec
);
39 /// Writes the <log_rec> to the standard output with the given
41 virtual void logv (const Logger::Log_Record
&log_rec
,
42 Logger::Verbosity_Level verbosity
);
44 /// Writes the <log_rec> to the standard output.
45 virtual void log_twoway (const Logger::Log_Record
&log_rec
);
47 /// Writes the <log_rec> to the standard output with the given
49 virtual void logv_twoway (const Logger::Log_Record
&log_rec
,
50 Logger::Verbosity_Level verbosity
);
52 /// Sets the verbosity level. Valid values are {VERBOSE, VERBOSE_LITE
53 /// and SILENT}. Defaults to VERBOSE
54 void verbosity (Logger::Verbosity_Level level
);
57 /// Converts the IDL defined <Log_Priority> enum type to the
58 /// <ACE_Log_Priority> enum type.
59 ACE_Log_Priority
priority_conversion (Logger::Log_Priority priority
);
62 * Converts the IDL defined <Verbosity_Level> enum type to a u_long,
63 * which is used by the <ACE_Log_Record> to distinguish the
66 u_long
verbosity_conversion (Logger::Verbosity_Level verbosity_level
);
68 /// Logger identification.
71 /// Keeps track of what our current verbosity level is. This can be
72 /// reset by the client to a new value at any point.
73 Logger::Verbosity_Level verbosity_level_
;
77 * @class Logger_Factory_i
79 * @brief Create a <Logger> of type <name>.
81 class Logger_Factory_i
: public virtual POA_Logger_Factory
85 Logger_Factory_i (void);
88 ~Logger_Factory_i (void);
91 * This function returns a logger with name <name>. If <name> is
92 * unique, a new logger is created; else, a previously created
93 * logger of name <name> is returned
95 virtual Logger_ptr
make_logger (const char *name
);
99 * Calls to <make_logger> will create a new instance of <Logger> and
100 * bind into the hash map manager if <name> is unique, else it will
101 * return a previously bound entry.
103 ACE_Hash_Map_Manager
<ACE_CString
, Logger_i
*, ACE_Null_Mutex
> hash_map_
;
106 #endif /* TAO_ORBSVCS_LOGGER_I_H */