Log_Msg.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Log_Msg.h
00006  *
00007  *  $Id: Log_Msg.h 81624 2008-05-06 17:14:57Z wotte $
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_LOG_MSG_H
00014 #define ACE_LOG_MSG_H
00015 #include /**/ "ace/pre.h"
00016 
00017 // This stuff must come first to avoid problems with circular
00018 // headers...
00019 // ... but ACE_NDEBUG and ACE_NLOGGING can come from the config.h file, so
00020 // pull that one early.
00021 #include /**/ "ace/config-all.h"
00022 #include /**/ "ace/ACE_export.h"
00023 #include "ace/Global_Macros.h"
00024 #include "ace/Default_Constants.h"
00025 #include "ace/Log_Priority.h"
00026 #include "ace/os_include/os_limits.h"
00027 
00028 // The ACE_ASSERT macro used to be defined here, include ace/Assert.h
00029 // for backwards compatibility.
00030 #include "ace/Assert.h"
00031 
00032 #if defined (ACE_NLOGGING)
00033 #define ACE_HEX_DUMP(X) do {} while (0)
00034 #define ACE_RETURN(Y) do { return (Y); } while (0)
00035 #define ACE_ERROR_RETURN(X, Y) return (Y)
00036 #define ACE_ERROR_BREAK(X) { break; }
00037 #define ACE_ERROR(X) do {} while (0)
00038 #define ACE_DEBUG(X) do {} while (0)
00039 #define ACE_ERROR_INIT(VALUE, FLAGS)
00040 #else
00041 #if !defined (ACE_HEX_DUMP)
00042 #define ACE_HEX_DUMP(X) \
00043   do { \
00044     int __ace_error = ACE_Log_Msg::last_error_adapter (); \
00045     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00046     ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
00047     ace___->log_hexdump X; \
00048   } while (0)
00049 #endif
00050 #if !defined (ACE_RETURN)
00051 #define ACE_RETURN(Y) \
00052   do { \
00053     int __ace_error = ACE_Log_Msg::last_error_adapter (); \
00054     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00055     ace___->set (__FILE__, __LINE__, Y, __ace_error, ace___->restart (), \
00056                  ace___->msg_ostream (), ace___->msg_callback ()); \
00057     return Y; \
00058   } while (0)
00059 #endif
00060 #if !defined (ACE_ERROR_RETURN)
00061 #define ACE_ERROR_RETURN(X, Y) \
00062   do { \
00063     int __ace_error = ACE_Log_Msg::last_error_adapter (); \
00064     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00065     ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \
00066     ace___->log X; \
00067     return Y; \
00068   } while (0)
00069 #endif
00070 #if !defined (ACE_ERROR)
00071 #define ACE_ERROR(X) \
00072   do { \
00073     int __ace_error = ACE_Log_Msg::last_error_adapter (); \
00074     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00075     ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \
00076     ace___->log X; \
00077   } while (0)
00078 #endif
00079 #if !defined (ACE_DEBUG)
00080 #define ACE_DEBUG(X) \
00081   do { \
00082     int __ace_error = ACE_Log_Msg::last_error_adapter (); \
00083     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00084     ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
00085     ace___->log X; \
00086   } while (0)
00087 #endif
00088 #if !defined (ACE_ERROR_INIT)
00089 #define ACE_ERROR_INIT(VALUE, FLAGS) \
00090   do { \
00091     ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
00092     ace___->set_flags (FLAGS); ace___->op_status (VALUE); \
00093   } while (0)
00094 #endif
00095 #if !defined (ACE_ERROR_BREAK)
00096 #define ACE_ERROR_BREAK(X) { ACE_ERROR (X); break; }
00097 #endif
00098 #endif /* ACE_NLOGGING */
00099 
00100 #include "ace/OS_Log_Msg_Attributes.h"
00101 
00102 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00103 # pragma once
00104 #endif /* ACE_LACKS_PRAGMA_ONCE */
00105 
00106 // These workarounds are necessary for nasty libraries or platforms
00107 // that #define STDERR or THREAD (e.g. LynxOS). We simply #undef
00108 // these macros as there is no way to save the macro definition using
00109 // the pre-processor. See Bugzilla Bug #299 for more info.
00110 
00111 #if defined (STDERR)
00112 # undef STDERR
00113 #endif /* STDERR */
00114 
00115 #if defined (THREAD)
00116 # undef THREAD
00117 #endif /* THREAD */
00118 
00119 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00120 
00121 class ACE_Log_Msg_Callback;
00122 class ACE_Log_Msg_Backend;
00123 
00124 // ****************************************************************
00125 
00126 #define ACE_LOG_MSG ACE_Log_Msg::instance ()
00127 
00128 // Forward declaration
00129 class ACE_Thread_Descriptor;
00130 class ACE_Log_Record;
00131 
00132 /**
00133  * @class ACE_Log_Msg
00134  *
00135  * @brief Provides a variable length argument message logging
00136  * abstraction.
00137  *
00138  * This class is very flexible since it allows formatted error
00139  * messages to be printed in a thread-safe manner to various
00140  * locations, such as stderr, cerr, a distributed logger, etc.  The
00141  * current message is also kept in a thread-specific storage location
00142  * (threads spawned using ACE_Thread_Manager automatically get an
00143  * ACE_Log_Msg object that inherits the spawning thread's settings),
00144  * which can be used to communicate errors between framework methods
00145  * and callers.  A message is logged by the log() method, only if the
00146  * message priority is currently enabled.  Moreover, only the current
00147  * log message is stored here -- it will be overwritten by the
00148  * subsequent call to log().
00149  *
00150  * The ACE_Log_Msg class uses two priority masks to control its
00151  * logging behavior.  The @c priority_mask_ object attribute is
00152  * thread- specific and specifies the priority levels logged by the
00153  * thread.  The @c process_priority_mask_ class attribute is not
00154  * thread-specific and specifies the priority levels that will be
00155  * logged by all threads in the process.  By default, all levels are
00156  * disabled for @c priority_mask_ and all levels are enabled for @c
00157  * process_priority_mask_ (i.e. the process-wide mask controls the
00158  * settings, and each instance can expand on it if desired).  Both
00159  * priority masks can be modified using the priority_mask() method of
00160  * this class.
00161  */
00162 class ACE_Export ACE_Log_Msg
00163 {
00164 public:
00165   // Logger Flags.
00166   enum
00167   {
00168     /// Write messages to stderr.
00169     STDERR = 1,
00170     /// Write messages to the local client logger deamon.
00171     LOGGER = 2,
00172     /// Write messages to the ostream * stored in thread-specific
00173     /// storage.
00174     OSTREAM = 4,
00175     /// Write messages to the callback object.
00176     MSG_CALLBACK = 8,
00177     /// Display messages in a verbose manner.
00178     VERBOSE = 16,
00179     /// Display messages in a less verbose manner (i.e., only print
00180     /// information that can change between calls).
00181     VERBOSE_LITE = 32,
00182     /// Do not print messages at all (just leave in thread-specific
00183     /// storage for later inspection).
00184     SILENT = 64,
00185     /// Write messages to the system's event log.
00186     SYSLOG = 128,
00187     /// Write messages to the user provided backend
00188     CUSTOM = 256
00189  };
00190 
00191   // = Initialization and termination routines.
00192 
00193   /// Returns a pointer to the Singleton.
00194   static ACE_Log_Msg *instance (void);
00195 
00196   /// Returns last error.
00197   static int last_error_adapter (void);
00198 
00199   /// Returns non-null if an ACE_Log_Msg exists for the calling thread.
00200   static int exists (void);
00201 
00202   /// Returns the current program name used for logging.
00203   static const ACE_TCHAR * program_name (void);
00204 
00205   /// Clears the flag from the default priority mask used to
00206   /// initialize ACE_Log_Msg instances.
00207   static void disable_debug_messages (ACE_Log_Priority priority = LM_DEBUG);
00208 
00209   /// Sets the flag in the default priority mask used to initialize
00210   /// ACE_Log_Msg instances.
00211   static void enable_debug_messages (ACE_Log_Priority priority = LM_DEBUG);
00212 
00213   /// Initialize logger.
00214   ACE_Log_Msg (void);
00215 
00216   /// cleanup logger.
00217   ~ACE_Log_Msg (void);
00218 
00219   /// Initialize the ACE logging facility.
00220   /**
00221    * Initialize the ACE logging facility. Supplies the program name
00222    * that is available to each logging message call. Default arguments
00223    * set up logging to STDERR only.
00224    *
00225    * @param prog_name      The name of the calling program.
00226    * @param options_flags  A bitwise-or of options flags used to set the
00227    *                       initial behavior and logging sink(s). (see the
00228    *                       enum above for the valid values).
00229    * @param logger_key     The name of ACE_FIFO rendezvous point where the
00230    *                       local client logger daemon is listening for logging
00231    *                       messages if the LOGGER bit is set in the @a flags
00232    *                       argument. If the SYSLOG bit is set in @a flags,
00233    *                       @a logger_key is the source/program name specified
00234    *                       in the syslog facility (UNIX/Linux) or the Windows
00235    *                       event log (Windows). In the SYSLOG case, if
00236    *                       @a logger_key is 0, @a prog_name is used.
00237    */
00238   int open (const ACE_TCHAR *prog_name,
00239             u_long options_flags = ACE_Log_Msg::STDERR,
00240             const ACE_TCHAR *logger_key = 0);
00241 
00242   // = Set/get the options flags.
00243 
00244   /**
00245    * Enable the bits in the logger's options flags.
00246    */
00247   void set_flags (u_long f);
00248 
00249   /**
00250    * Disable the bits in the logger's options flags.
00251    */
00252   void clr_flags (u_long f);
00253 
00254   /**
00255    * Return the bits in the logger's options flags.
00256    */
00257   u_long flags (void);
00258 
00259   /** @name Allow apps to acquire and release internal synchronization
00260    *        lock
00261    *
00262    * This lock is used internally by the ACE_Log_Msg
00263    * implementation. By exporting the lock, applications can hold the
00264    * lock atomically over a number of calls to ACE_Log_Msg.
00265    */
00266   //@{
00267 
00268   /// Acquire the internal lock.
00269   int acquire (void);
00270 
00271   /// Release the internal lock.
00272   int release (void);
00273   //@}
00274 
00275   /// Call after doing a @c fork() to resynchronize the process id and
00276   /// @c program_name_ variables.
00277   void sync (const ACE_TCHAR *program_name);
00278 
00279   // = Set/get methods.  Note that these are non-static and thus will
00280   // be thread-specific.
00281 
00282   /// Set the result of the operation status (by convention, -1 means
00283   /// error).
00284   void op_status (int status);
00285 
00286   /// Get the result of the operation status (by convention, -1 means
00287   /// error).
00288   int op_status (void) const;
00289 
00290   /// Set the value of the errnum (by convention this corresponds to
00291   /// errno).
00292   void errnum (int);
00293 
00294   /// Get the value of the errnum (by convention this corresponds to
00295   /// errno).
00296   int errnum (void) const;
00297 
00298   /// Set the line number where an error occurred.
00299   void linenum (int);
00300 
00301   /// Get the line number where an error occurred.
00302   int linenum (void) const;
00303 
00304   /// Set the file name where an error occurred.
00305   void file (const char *);
00306 
00307   /// Get the file name where an error occurred.
00308   const char *file (void);
00309 
00310   /// Set the message that describes what type of error occurred.
00311   void msg (const ACE_TCHAR *);
00312 
00313   /// Get the message that describes what type of error occurred.
00314   const ACE_TCHAR *msg (void);
00315 
00316   /// Set the field that indicates whether interrupted calls should be
00317   /// restarted.
00318   void restart (int);
00319 
00320   /// Get the field that indicates whether interrupted calls should be
00321   /// restarted.
00322   int restart (void) const;
00323 
00324   // = Notice that the following two function is equivalent to
00325   //   "void msg_ostream (HANDLE)" and "HANDLE msg_ostream (void)"
00326   //   on Windows CE.  There is no <iostream.h> support on CE.
00327 
00328   /// Update the ostream without overwriting the delete_ostream_ flag.
00329   void msg_ostream (ACE_OSTREAM_TYPE *);
00330 
00331   /**
00332    * delete_stream == true, forces Log_Msg.h to delete the stream in
00333    * its own ~dtor (assumes control of the stream)
00334    * use only with proper ostream (eg: fstream), not (cout, cerr)
00335    */
00336   void msg_ostream (ACE_OSTREAM_TYPE *, bool delete_ostream);
00337 
00338   /// Get the ostream that is used to print error messages.
00339   ACE_OSTREAM_TYPE *msg_ostream (void) const;
00340 
00341   /**
00342    * Set a new callback object and return the existing callback to
00343    * allow "chaining".  Note that ACE_Log_Msg_Callback objects are not
00344    * inherited when spawning a new thread, so you'll need to reset
00345    * them in each thread.
00346    */
00347   ACE_Log_Msg_Callback *msg_callback (ACE_Log_Msg_Callback *c);
00348   ACE_Log_Msg_Callback *msg_callback (void) const;
00349 
00350   /**
00351    * Set a new backend object and return the existing backend to
00352    * allow "chaining". Note that as opposed to ACE_Log_Msg_Callback,
00353    * ACE_Log_Msg_Backend is a per-process entity.
00354    *
00355    * @note Be aware that because of the current architecture there is
00356    * no guarantee that open (), reset () and close () will be called
00357    * on a backend object.
00358    *
00359    */
00360   static ACE_Log_Msg_Backend *msg_backend (ACE_Log_Msg_Backend *b);
00361   static ACE_Log_Msg_Backend *msg_backend (void);
00362 
00363   /// Nesting depth increment.
00364   int inc (void);
00365 
00366   /// Nesting depth decrement.
00367   int dec (void);
00368 
00369   /// Get trace depth.
00370   int trace_depth (void) const;
00371 
00372   /// Set trace depth.
00373   void trace_depth (int);
00374 
00375   /// Get trace active status.
00376   bool trace_active (void) const;
00377 
00378   /// Set  trace active status.
00379   void trace_active (bool value);
00380 
00381   /// Get the TSS thread descriptor.
00382   ACE_Thread_Descriptor *thr_desc (void) const;
00383 
00384   /**
00385    * Set the TSS thread descriptor.  This method will call
00386    * td->acquire_release to block execution until this call
00387    * return.
00388    */
00389   void thr_desc (ACE_Thread_Descriptor *td);
00390 
00391 #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) && defined(ACE_LEGACY_MODE)
00392   // These functions are disabled without ACE_LEGACY_MODE
00393   // because the *semantics* have changed (the objects are no longer
00394   // TSS).
00395   /// Get TSS exception action.
00396   /// @note The action is no longer TSS, they are global!
00397   ACE_SEH_EXCEPT_HANDLER seh_except_selector (void);
00398 
00399   /// Set TSS exception action.
00400   /// @note The action is no longer TSS, they are global!
00401   ACE_SEH_EXCEPT_HANDLER seh_except_selector (ACE_SEH_EXCEPT_HANDLER);
00402 
00403   /// Get TSS exception handler.
00404   /// @note The handler is no longer TSS, they are global!
00405   ACE_SEH_EXCEPT_HANDLER seh_except_handler (void);
00406 
00407   /// Set TSS exception handler.
00408   /// @note The handler is no longer TSS, they are global!
00409   ACE_SEH_EXCEPT_HANDLER seh_except_handler (ACE_SEH_EXCEPT_HANDLER);
00410 #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS && ACE_LEGACY_MODE */
00411 
00412   /// Stop tracing status on a per-thread basis...
00413   void stop_tracing (void);
00414 
00415   /// Start tracing status on a per-thread basis...
00416   void start_tracing (void);
00417 
00418   /// Query tracing status on a per-thread basis...
00419   bool tracing_enabled (void) const;
00420 
00421   typedef enum
00422   {
00423     PROCESS = 0,
00424     THREAD = 1
00425   } MASK_TYPE;
00426 
00427   // = Get/set the priority mask.
00428   /// Get the current ACE_Log_Priority mask.
00429   u_long priority_mask (MASK_TYPE = THREAD);
00430 
00431   /// Set the ACE_Log_Priority mask, returns original mask.
00432   u_long priority_mask (u_long, MASK_TYPE = THREAD);
00433 
00434   /// Return true if the requested priority is enabled.
00435   int log_priority_enabled (ACE_Log_Priority log_priority);
00436 
00437   /// Return true if the requested priority is enabled.
00438   int log_priority_enabled (ACE_Log_Priority log_priority,
00439                             const char *,
00440                             ...);
00441 
00442 #if defined (ACE_USES_WCHAR)
00443   // We are not using ACE_TCHAR for this since ACE_HEX_DUMP
00444   // doesn't take in a ACE_TCHAR.  log_hexdump takes in a char
00445   // string, so this must be able to take in a char string even
00446   // when using ACE_USES_WCHAR.
00447   /// Return true if the requested priority is enabled.
00448   int log_priority_enabled (ACE_Log_Priority log_priority,
00449                             const wchar_t *,
00450                             ...);
00451 #endif /* ACE_USES_WCHAR */
00452 
00453   /// Optimize reading of the pid (avoids a system call if the value is
00454   /// cached...).
00455   pid_t getpid (void) const;
00456 
00457   /// Get the name of the local host.
00458   const ACE_TCHAR *local_host (void) const;
00459 
00460   /// Set the name of the local host.
00461   void local_host (const ACE_TCHAR *);
00462 
00463   /**
00464    * Set the line number, file name, operational status, error number,
00465    * restart flag, ostream, and the callback object.  This combines
00466    * all the other set methods into a single method.
00467    */
00468   void set (const char *file,
00469             int line,
00470             int op_status = -1,
00471             int errnum = 0,
00472             int restart = 1,
00473             ACE_OSTREAM_TYPE *os = 0,
00474             ACE_Log_Msg_Callback *c = 0);
00475 
00476   /// These values are only actually set if the requested priority is
00477   /// enabled.
00478   void conditional_set (const char *file,
00479                         int line,
00480                         int op_status,
00481                         int errnum);
00482 
00483   /**
00484    * Format a message to the thread-safe ACE logging mechanism.  Valid
00485    * options (prefixed by '%', as in printf format strings) include:
00486    *  - 'A': print an ACE_timer_t value (which could be either double
00487    *         or ACE_UINT32.)
00488    *  - 'a': abort the program at this point abruptly.
00489    *  - 'b': print a ssize_t value
00490    *  - 'B': print a size_t value
00491    *  - 'c': print a character
00492    *  - 'C': print a char* character string (also see s and W)
00493    *  - 'i', 'd': print a decimal number
00494    *  - 'I': indent according to nesting depth (obtained from
00495    *         ACE_Trace::get_nesting_indent()).
00496    *  - 'e', 'E', 'f', 'F', 'g', 'G': print a double
00497    *  - 'l': print line number where an error occurred.
00498    *  - 'M': print the name of the priority of the message.
00499    *  - 'm': return the message corresponding to errno value, e.g., as
00500    *         done by strerror()
00501    *  - 'N': print file name where the error occurred.
00502    *  - 'n': print the name of the program (or "<unknown>" if not set)
00503    *  - 'o': print as an octal number
00504    *  - 'P': print out the current process id
00505    *  - 'p': print out the appropriate errno message from sys_errlist,
00506    *         e.g., as done by perror()
00507    *  - 'Q': print out the uint64 number
00508    *  - 'q': print out the int64 number
00509    *  - '@': print a void* pointer (in hexadecimal)
00510    *  - 'r': call the function pointed to by the corresponding argument
00511    *  - 'R': print return status
00512    *  - 'S': print out the appropriate _sys_siglist entry corresponding
00513    *         to var-argument.
00514    *  - 's': prints a ACE_TCHAR* character string (also see C and W)
00515    *  - 'T': print timestamp in hour:minute:sec:usec format.
00516    *  - 'D': print timestamp as Weekday Month day year hour:minute:sec.usec
00517    *  - 't': print thread id (1 if single-threaded)
00518    *  - 'u': print as unsigned int
00519    *  - 'w': prints a wide character
00520    *  - 'W': prints a wchar_t* character string (also see C and s)
00521    *  - 'x': print as a hex number
00522    *  - 'X': print as a hex number
00523    *  - 'z': print an ACE_OS::WChar character
00524    *  - 'Z': print an ACE_OS::WChar character string
00525    *  - ':': print a time_t value as an integral number
00526    *  - '%': print out a single percent sign, '%'
00527    */
00528   ssize_t log (ACE_Log_Priority priority, const ACE_TCHAR *format, ...);
00529 
00530 #if defined (ACE_HAS_WCHAR)
00531   ssize_t log (ACE_Log_Priority priority, const ACE_ANTI_TCHAR *format, ...);
00532 #endif /* ACE_HAS_WCHAR */
00533 
00534   /**
00535    * An alternative logging mechanism that makes it possible to
00536    * integrate variable argument lists from other logging mechanisms
00537    * into the ACE mechanism.
00538    */
00539   ssize_t log (const ACE_TCHAR *format,
00540                ACE_Log_Priority priority,
00541                va_list argp);
00542 
00543   /// Log a custom built log record to the currently enabled logging
00544   /// sinks.
00545   ssize_t log (ACE_Log_Record &log_record,
00546                int suppress_stderr = 0);
00547 
00548   /**
00549    * Method to log hex dump.  This is useful for debugging.  Calls
00550    * log() to do the actual print, but formats first to make the chars
00551    * printable.
00552    */
00553   int log_hexdump (ACE_Log_Priority log_priority,
00554                    const char *buffer,
00555                    size_t size,
00556                    const ACE_TCHAR *text = 0);
00557 
00558   static void init_hook (ACE_OS_Log_Msg_Attributes &attributes
00559 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
00560                          , ACE_SEH_EXCEPT_HANDLER selector = 0
00561                          , ACE_SEH_EXCEPT_HANDLER handler = 0
00562 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
00563   /**
00564    * Init hook, create a Log_Msg_Attribute object, initialize its
00565    * attributes from the TSS Log_Msg and save the object in the
00566    * @a attributes argument
00567    */
00568                          );
00569 
00570   /**
00571    * Inherit hook, the @a attributes field is a ACE_OS_Log_Msg_Attributes
00572    * object, invoke the inherit_log_msg() method on it, then destroy
00573    * it and set the @a attribute argument to 0.
00574    */
00575   static void inherit_hook (ACE_OS_Thread_Descriptor *thr_desc,
00576                             ACE_OS_Log_Msg_Attributes &attributes);
00577 
00578   /// Dump the state of an object.
00579   void dump (void) const;
00580 
00581   /// Declare the dynamic allocation hooks.
00582   ACE_ALLOC_HOOK_DECLARE;
00583 
00584 private:
00585   /// Status of operation (-1 means failure, >= 0 means success).
00586   int status_;
00587 
00588   /// Type of error that occurred (see <sys/errno.h>).
00589   int errnum_;
00590 
00591   /// Line number where the error occurred.
00592   int linenum_;
00593 
00594   /// File where the error occurred.
00595   char file_[MAXPATHLEN + 1];
00596 
00597   /// The log message, which resides in thread-specific storage.  Note
00598   /// that only the current log message is stored here -- it will be
00599   /// overwritten by the subsequent call to log().
00600   ACE_TCHAR* msg_; // Add one for NUL-terminator.
00601 
00602   /// Indicates whether we should restart system calls that are
00603   /// interrupted.
00604   int restart_;
00605 
00606   /// The ostream where logging messages can be written.
00607   ACE_OSTREAM_TYPE *ostream_;
00608 
00609   /// The callback object.
00610   ACE_Log_Msg_Callback *msg_callback_;
00611 
00612   /// Depth of the nesting for printing traces.
00613   int trace_depth_;
00614 
00615   /// Are we already within an ACE_Trace constructor call?
00616   bool trace_active_;
00617 
00618   /// Are we allowing tracing in this thread?
00619   bool tracing_enabled_;
00620 
00621   /// Are we deleting this ostream?
00622   bool delete_ostream_;
00623 
00624   /**
00625    * If we're running in the context of an ACE_Thread_Manager this
00626    * will point to the thread descriptor adapter which holds the
00627    * thread descriptor of the thread.  This can be used to repidly
00628    * access all thread data kept in ACE_Thread_Descriptor.
00629    */
00630   ACE_Thread_Descriptor *thr_desc_;
00631 
00632   /**
00633    * Keeps track of all the per-thread ACE_Log_Priority values that
00634    * are currently enabled.  Default is for all logging priorities to
00635    * be disabled.
00636    */
00637   u_long priority_mask_;
00638 
00639   /// Always timestamp?
00640   int timestamp_;
00641 
00642   // = The following fields are *not* kept in thread-specific storage.
00643 
00644   // We only want one instance for the entire process!
00645 
00646   /**
00647    * Keeps track of all the per-process ACE_Log_Priority values that
00648    * are currently enabled.  Default is for all logging priorities to
00649    * be enabled.
00650    */
00651   static u_long process_priority_mask_;
00652 
00653   /// Records the program name.
00654   static const ACE_TCHAR *program_name_;
00655 
00656   /// Name of the local host (used when printing messages).
00657   static const ACE_TCHAR *local_host_;
00658 
00659   /// Process id of the current process.
00660   static pid_t pid_;
00661 
00662   /// Options flags used to hold the logger flag options, e.g.,
00663   /// STDERR, LOGGER, OSTREAM, MSG_CALLBACK, etc.
00664   static u_long flags_;
00665 
00666   /// Offset of msg_[].
00667   static ptrdiff_t msg_off_;
00668 
00669   /**
00670    * Number of existing ACE_Log_Msg instances; when 0, delete program/host
00671    * names
00672    */
00673   static int instance_count_;
00674 
00675   /**
00676    * Priority mask to use for each new instance
00677    */
00678   static u_long default_priority_mask_;
00679 
00680   /// Anonymous struct since there will only be one instance.  This
00681   /// struct keeps information stored away in case we actually end up
00682   /// calling log() if the log priority is correct.
00683   struct
00684   {
00685     bool is_set_;
00686     const char *file_;
00687     int line_;
00688     int op_status_;
00689     int errnum_;
00690   } conditional_values_;
00691 
00692 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00693   static int key_created_;
00694 #endif /* ACE_MT_SAFE */
00695 
00696   /// For cleanup, at program termination.
00697   static void close (void);
00698 
00699   /// Decouple the OS layer from the ACE_Log_Msg layer.
00700   static void sync_hook (const ACE_TCHAR *prg_name);
00701 
00702   /// Return the TSS singleton thread descriptor
00703   static ACE_OS_Thread_Descriptor *thr_desc_hook (void);
00704 
00705   //friend void ACE_OS::cleanup_tss (const u_int);
00706 
00707   // = Disallow these operations.
00708   ACE_Log_Msg &operator= (const ACE_Log_Msg &);
00709   ACE_Log_Msg (const ACE_Log_Msg &);
00710 };
00711 
00712 ACE_END_VERSIONED_NAMESPACE_DECL
00713 
00714 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00715 # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \
00716      defined (ACE_HAS_TSS_EMULATION)
00717 /* static */
00718 #  if defined (ACE_HAS_THR_C_DEST)
00719 #   define LOCAL_EXTERN_PREFIX extern "C"
00720 #  else
00721 #   define LOCAL_EXTERN_PREFIX
00722 #  endif /* ACE_HAS_THR_C_DEST */
00723 
00724 #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
00725 # define ACE_TSS_CLEANUP_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _TSS_cleanup))
00726 #else
00727 # define ACE_TSS_CLEANUP_NAME ACE_TSS_cleanup
00728 #endif  /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
00729 
00730 
00731 LOCAL_EXTERN_PREFIX
00732 void
00733 ACE_TSS_CLEANUP_NAME (void *ptr);
00734 # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */
00735 #endif /* ACE_MT_SAFE */
00736 
00737 #if defined(ACE_LEGACY_MODE)
00738 #include "ace/Log_Msg_Callback.h"
00739 #endif /* ACE_LEGACY_MODE */
00740 
00741 #if defined (__ACE_INLINE__)
00742 #include "ace/Log_Msg.inl"
00743 #endif /* __ACE_INLINE__ */
00744 
00745 #include /**/ "ace/post.h"
00746 #endif /* ACE_LOG_MSG_H */

Generated on Tue Feb 2 17:18:40 2010 for ACE by  doxygen 1.4.7