00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "ace/Log_Priority.h"
00017
00018 #ifndef ACE_LOG_RECORD_H
00019 #define ACE_LOG_RECORD_H
00020 #include "ace/pre.h"
00021
00022 #include "ace/ACE_export.h"
00023
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif
00027
00028 #include "ace/Default_Constants.h"
00029 #include "ace/Basic_Types.h"
00030 #include "ace/iosfwd.h"
00031
00032 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00033
00034 class ACE_Time_Value;
00035
00036
00037 class ACE_Export ACE_Log_Record
00038 {
00039 public:
00040 enum
00041 {
00042
00043 MAXLOGMSGLEN = ACE_MAXLOGMSGLEN+1,
00044
00045
00046 ALIGN_WORDB = 8,
00047
00048
00049
00050
00051 VERBOSE_LEN = 128,
00052
00053
00054 MAXVERBOSELOGMSGLEN = VERBOSE_LEN + MAXLOGMSGLEN
00055 };
00056
00057
00058
00059
00060
00061
00062 ACE_Log_Record (void);
00063 ACE_Log_Record (ACE_Log_Priority lp,
00064 long time_stamp,
00065 long pid);
00066 ACE_Log_Record (ACE_Log_Priority lp,
00067 const ACE_Time_Value &time_stamp,
00068 long pid);
00069
00070
00071 ~ACE_Log_Record (void);
00072
00073
00074
00075
00076 int print (const ACE_TCHAR host_name[],
00077 u_long verbose_flag,
00078 #if !defined (ACE_HAS_WINCE)
00079 FILE *fp = stderr);
00080 #else
00081 FILE *fp);
00082 #endif
00083
00084 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00085
00086
00087 int print (const ACE_TCHAR host_name[],
00088 u_long verbose_flag,
00089 ACE_OSTREAM_TYPE &stream);
00090 #endif
00091
00092 int format_msg (const ACE_TCHAR host_name[],
00093 u_long verbose_flag,
00094 ACE_TCHAR *verbose_msg);
00095
00096
00097
00098
00099
00100
00101 static const ACE_TCHAR *priority_name (ACE_Log_Priority p);
00102
00103
00104 static void priority_name (ACE_Log_Priority p,
00105 const ACE_TCHAR *name);
00106
00107
00108
00109 void encode (void);
00110
00111
00112 void decode (void);
00113
00114
00115
00116
00117 ACE_UINT32 type (void) const;
00118
00119
00120 void type (ACE_UINT32);
00121
00122
00123
00124
00125
00126
00127 u_long priority (void) const;
00128
00129
00130
00131 void priority (u_long num);
00132
00133
00134 long length (void) const;
00135
00136
00137 void length (long);
00138
00139
00140 ACE_Time_Value time_stamp (void) const;
00141
00142
00143 void time_stamp (const ACE_Time_Value &ts);
00144
00145
00146 long pid (void) const;
00147
00148
00149 void pid (long);
00150
00151
00152 const ACE_TCHAR *msg_data (void) const;
00153
00154
00155 void set_msg_data_ptr (ACE_TCHAR *data);
00156
00157
00158 void msg_data (const ACE_TCHAR *data);
00159
00160
00161
00162 size_t msg_data_len (void) const;
00163
00164
00165 void dump (void) const;
00166
00167
00168 ACE_ALLOC_HOOK_DECLARE;
00169
00170 private:
00171
00172 void round_up (void);
00173
00174
00175
00176
00177
00178
00179
00180 ACE_INT32 length_;
00181
00182
00183 ACE_UINT32 type_;
00184
00185
00186 ACE_UINT32 secs_;
00187 ACE_UINT32 usecs_;
00188
00189
00190 ACE_UINT32 pid_;
00191
00192
00193 ACE_TCHAR *msg_data_;
00194
00195 };
00196
00197
00198 class ACE_InputCDR;
00199 class ACE_OutputCDR;
00200
00201
00202 ACE_Export int operator>> (ACE_InputCDR &cdr, ACE_Log_Record &log_record);
00203 ACE_Export int operator<< (ACE_OutputCDR &cdr, const ACE_Log_Record &log_record);
00204
00205 ACE_END_VERSIONED_NAMESPACE_DECL
00206
00207 #if defined (__ACE_INLINE__)
00208 #include "ace/Log_Record.inl"
00209 #endif
00210
00211 #include "ace/post.h"
00212 #endif