00001 // -*- C++ -*- 00002 // 00003 // $Id: Log_Msg.inl 80826 2008-03-04 14:51:23Z wotte $ 00004 00005 #include "ace/OS_NS_string.h" 00006 #include "ace/OS_NS_unistd.h" 00007 00008 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00009 00010 ACE_INLINE 00011 u_long 00012 ACE_Log_Msg::priority_mask (MASK_TYPE mask_type) 00013 { 00014 return mask_type == THREAD 00015 ? this->priority_mask_ 00016 : ACE_Log_Msg::process_priority_mask_; 00017 } 00018 00019 ACE_INLINE 00020 int 00021 ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority) 00022 { 00023 return ACE_BIT_ENABLED (this->priority_mask_ | 00024 ACE_Log_Msg::process_priority_mask_, 00025 log_priority); 00026 } 00027 00028 ACE_INLINE 00029 void 00030 ACE_Log_Msg::op_status (int status) 00031 { 00032 this->status_ = status; 00033 } 00034 00035 ACE_INLINE 00036 int 00037 ACE_Log_Msg::op_status (void) const 00038 { 00039 return this->status_; 00040 } 00041 00042 ACE_INLINE 00043 void 00044 ACE_Log_Msg::restart (int r) 00045 { 00046 this->restart_ = r; 00047 } 00048 00049 ACE_INLINE 00050 int 00051 ACE_Log_Msg::restart (void) const 00052 { 00053 return this->restart_; 00054 } 00055 00056 ACE_INLINE 00057 int 00058 ACE_Log_Msg::errnum (void) const 00059 { 00060 return this->errnum_; 00061 } 00062 00063 ACE_INLINE 00064 void 00065 ACE_Log_Msg::errnum (int e) 00066 { 00067 this->errnum_ = e; 00068 } 00069 00070 ACE_INLINE 00071 int 00072 ACE_Log_Msg::linenum (void) const 00073 { 00074 return this->linenum_; 00075 } 00076 00077 ACE_INLINE 00078 void 00079 ACE_Log_Msg::linenum (int l) 00080 { 00081 this->linenum_ = l; 00082 } 00083 00084 ACE_INLINE 00085 int 00086 ACE_Log_Msg::inc (void) 00087 { 00088 return this->trace_depth_++; 00089 } 00090 00091 ACE_INLINE 00092 int 00093 ACE_Log_Msg::dec (void) 00094 { 00095 return this->trace_depth_ == 0 ? 0 : --this->trace_depth_; 00096 } 00097 00098 ACE_INLINE 00099 int 00100 ACE_Log_Msg::trace_depth (void) const 00101 { 00102 return this->trace_depth_; 00103 } 00104 00105 ACE_INLINE 00106 void 00107 ACE_Log_Msg::trace_depth (int depth) 00108 { 00109 this->trace_depth_ = depth; 00110 } 00111 00112 ACE_INLINE 00113 bool 00114 ACE_Log_Msg::trace_active (void) const 00115 { 00116 return this->trace_active_; 00117 } 00118 00119 ACE_INLINE 00120 void 00121 ACE_Log_Msg::trace_active (bool value) 00122 { 00123 this->trace_active_ = value; 00124 } 00125 00126 ACE_INLINE 00127 ACE_Thread_Descriptor * 00128 ACE_Log_Msg::thr_desc (void) const 00129 { 00130 return this->thr_desc_; 00131 } 00132 00133 /// Enable the tracing facility on a per-thread basis. 00134 ACE_INLINE 00135 void 00136 ACE_Log_Msg::start_tracing (void) 00137 { 00138 this->tracing_enabled_ = true; 00139 } 00140 00141 /// Disable the tracing facility on a per-thread basis. 00142 ACE_INLINE 00143 void 00144 ACE_Log_Msg::stop_tracing (void) 00145 { 00146 this->tracing_enabled_ = false; 00147 } 00148 00149 ACE_INLINE 00150 bool 00151 ACE_Log_Msg::tracing_enabled (void) const 00152 { 00153 return this->tracing_enabled_; 00154 } 00155 00156 ACE_INLINE 00157 const char * 00158 ACE_Log_Msg::file (void) 00159 { 00160 return this->file_; 00161 } 00162 00163 ACE_INLINE 00164 void 00165 ACE_Log_Msg::file (const char *s) 00166 { 00167 ACE_OS::strsncpy (this->file_, s, sizeof this->file_); 00168 } 00169 00170 ACE_INLINE 00171 const ACE_TCHAR * 00172 ACE_Log_Msg::msg (void) 00173 { 00174 return this->msg_ + ACE_Log_Msg::msg_off_; 00175 } 00176 00177 ACE_INLINE 00178 void 00179 ACE_Log_Msg::msg (const ACE_TCHAR *m) 00180 { 00181 ACE_OS::strsncpy (this->msg_, m, 00182 ((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR))); 00183 } 00184 00185 ACE_INLINE 00186 ACE_Log_Msg_Callback * 00187 ACE_Log_Msg::msg_callback (void) const 00188 { 00189 return this->msg_callback_; 00190 } 00191 00192 ACE_INLINE 00193 ACE_Log_Msg_Callback * 00194 ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c) 00195 { 00196 ACE_Log_Msg_Callback *old = this->msg_callback_; 00197 this->msg_callback_ = c; 00198 return old; 00199 } 00200 00201 ACE_INLINE 00202 ACE_OSTREAM_TYPE * 00203 ACE_Log_Msg::msg_ostream (void) const 00204 { 00205 return this->ostream_; 00206 } 00207 00208 ACE_INLINE 00209 void 00210 ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m) 00211 { 00212 this->ostream_ = m; 00213 } 00214 00215 ACE_INLINE 00216 const ACE_TCHAR * 00217 ACE_Log_Msg::local_host (void) const 00218 { 00219 return ACE_Log_Msg::local_host_; 00220 } 00221 00222 ACE_INLINE 00223 pid_t 00224 ACE_Log_Msg::getpid (void) const 00225 { 00226 if (ACE_Log_Msg::pid_ == -2) 00227 ACE_Log_Msg::pid_ = ACE_OS::getpid (); 00228 00229 return ACE_Log_Msg::pid_; 00230 } 00231 00232 00233 00234 ACE_END_VERSIONED_NAMESPACE_DECL 00235