summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-04-14 02:21:08 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-04-14 02:21:08 +0000
commit3866310e8599832468db8c66c9974a21b0267eee (patch)
treeda99896eb8215a1b6bea0b39eb20c2ed3cf209fa
parentb1714e85be8fccae45ef0bfcd8897ec05175ddbd (diff)
downloadATCD-3866310e8599832468db8c66c9974a21b0267eee.tar.gz
*** empty log message ***
-rw-r--r--ace/Log_Msg.cpp10
-rw-r--r--ace/Log_Msg.h7
-rw-r--r--ace/Log_Priority.h2
-rw-r--r--ace/Log_Record.cpp72
-rw-r--r--ace/Log_Record.h19
-rw-r--r--tests/test_config.h4
6 files changed, 81 insertions, 33 deletions
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index 6547ff6f2d3..5a7fe7bd69d 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -947,13 +947,13 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::STDERR)
&& !suppress_stderr) // This is taken care of by our caller.
- log_record.print (ACE_Log_Msg::local_host_
- ,ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE)
+ log_record.print (ACE_Log_Msg::local_host_,
+ ACE_Log_Msg::flags_
#if defined (ACE_HAS_WINCE)
);
#else
- ,stderr);
-#endif
+ , stderr);
+#endif /* ACE_HAS_WINCE */
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::LOGGER))
@@ -984,7 +984,7 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record,
ACE_Log_Msg::OSTREAM)
&& this->msg_ostream () != 0)
log_record.print (ACE_Log_Msg::local_host_,
- ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE),
+ ACE_Log_Msg::flags_,
#if !defined (ACE_HAS_WINCE)
*this->msg_ostream ());
#else
diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h
index 32f6275e42d..2b5fb1f56c4 100644
--- a/ace/Log_Msg.h
+++ b/ace/Log_Msg.h
@@ -124,7 +124,10 @@ public:
// storage.
VERBOSE = 010,
// Display messages in a verbose manner.
- SILENT = 020
+ VERBOSE_LITE = 020,
+ // Display messages in a less verbose manner (i.e., only print
+ // information that can change between calls).
+ SILENT = 040
// Do not print messages at all (just leave in thread-specific
// storage for later inspection).
};
@@ -134,7 +137,7 @@ public:
static ACE_Log_Msg *instance (void);
// Returns a pointer to the Singleton.
- static int exists(void);
+ static int exists (void);
// Returns non-null if an ACE_Log_Msg exists for the calling thread.
ACE_Log_Msg (void);
diff --git a/ace/Log_Priority.h b/ace/Log_Priority.h
index 76040e7cc6b..29f8d053077 100644
--- a/ace/Log_Priority.h
+++ b/ace/Log_Priority.h
@@ -68,7 +68,7 @@ enum ACE_Log_Priority
LM_MAX = LM_EMERGENCY,
// The maximum logging priority.
-
+
// Do not use!!, this enum value ensures that the underlying
// integral type for this enum is at least 32 bits.
#if !defined (ACE_HAS_BROKEN_ENUMS)
diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp
index b9b7e97fc67..a510ccd1b68 100644
--- a/ace/Log_Record.cpp
+++ b/ace/Log_Record.cpp
@@ -7,6 +7,27 @@
ACE_ALLOC_HOOK_DEFINE(ACE_Log_Record)
+const char *ACE_Log_Record::priority_names_[] =
+{
+ "LM_SHUTDOWN",
+ "LM_TRACE",
+ "LM_DEBUG",
+ "LM_INFO",
+ "LM_NOTICE",
+ "LM_WARNING",
+ "LM_STARTUP",
+ "LM_ERROR",
+ "LM_CRITICAL",
+ "LM_ALERT",
+ "LM_EMERGENCY"
+};
+
+const char *
+ACE_Log_Record::priority_name (ACE_Log_Priority p)
+{
+ return ACE_Log_Record::priority_names_[ACE::log2 (p)];
+}
+
u_long
ACE_Log_Record::priority (void) const
{
@@ -92,14 +113,14 @@ ACE_Log_Record::ACE_Log_Record (void)
int
ACE_Log_Record::print (const ASYS_TCHAR *host_name,
- int verbose,
+ u_long verbose_flag,
FILE *fp)
{
// ACE_TRACE ("ACE_Log_Record::print");
int ret;
- if (verbose)
+ if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE))
{
time_t now = this->time_stamp_.sec ();
ASYS_TCHAR ctp[26]; // 26 is a magic number...
@@ -116,17 +137,25 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name,
const ASYS_TCHAR *lhost_name = host_name ==
0 ? ASYS_TEXT ("<local_host>") : host_name;
- ret = ACE_OS::fprintf (fp, ASYS_TEXT ("%s.%d %s@%s@%d@%d@%s"),
+ ret = ACE_OS::fprintf (fp,
+ ASYS_TEXT ("%s.%d %s@%s@%d@%s@%s"),
ctp + 4,
this->time_stamp_.usec () / 1000,
ctp + 20,
lhost_name,
this->pid_,
- this->type_,
+ ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_)),
this->msg_data_);
}
+ else if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE))
+ ret = ACE_OS::fprintf (fp,
+ ASYS_TEXT ("%s@%s"),
+ ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_)),
+ this->msg_data_);
else
- ret = ACE_OS::fprintf (fp, ASYS_TEXT ("%s"), this->msg_data_);
+ ret = ACE_OS::fprintf (fp,
+ ASYS_TEXT ("%s"),
+ this->msg_data_);
if (ret > 0)
ACE_OS::fflush (fp);
@@ -136,12 +165,12 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name,
#if !defined (ACE_HAS_WINCE)
int
ACE_Log_Record::print (const ASYS_TCHAR host_name[],
- int verbose,
+ u_long verbose_flag,
ostream &s)
{
// ACE_TRACE ("ACE_Log_Record::print");
- if (verbose)
+ if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE))
{
time_t now = this->time_stamp_.sec ();
ASYS_TCHAR ctp[26]; // 26 is a magic number...
@@ -168,9 +197,12 @@ ACE_Log_Record::print (const ASYS_TCHAR host_name[],
<< '@'
<< this->pid_
<< '@'
- << this->type_
+ << ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_))
<< '@';
}
+ else if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE))
+ s << ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_))
+ << '@';
s << this->msg_data_;
s.flush ();
@@ -179,7 +211,7 @@ ACE_Log_Record::print (const ASYS_TCHAR host_name[],
#else /* ACE_HAS_WINCE */
int
ACE_Log_Record::print (const ASYS_TCHAR *host_name,
- int verbose,
+ u_long verbose_flag,
ACE_CE_Bridge *log_window)
{
// ACE_TRACE ("ACE_Log_Record::print");
@@ -187,7 +219,7 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name,
int ret;
CString *msg = new CString ();
- if (verbose)
+ if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE))
{
time_t now = this->time_stamp_.sec ();
ASYS_TCHAR ctp[26]; // 26 is a magic number...
@@ -204,15 +236,19 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name,
const ASYS_TCHAR *lhost_name = host_name ==
0 ? ASYS_TEXT ("<local_host>") : host_name;
- msg->Format (ASYS_TEXT ("%s.%d %s@%s@%d@%d@%s"),
- ctp + 4,
- this->time_stamp_.usec () / 1000,
- ctp + 20,
- lhost_name,
- this->pid_,
- this->type_,
- this->msg_data_);
+ msg->Format (ASYS_TEXT ("%s.%d %s@%s@%d@%s@%s"),
+ ctp + 4,
+ this->time_stamp_.usec () / 1000,
+ ctp + 20,
+ lhost_name,
+ this->pid_,
+ ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_)),
+ this->msg_data_);
}
+ else if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE))
+ msg->Format (ASYS_TEXT ("%s@%s"),
+ ACE_Log_Record::priority_name (ACE_Log_Priority (this->type_)),
+ this->msg_data_);
else
msg->Format (ASYS_TEXT ("%s"), this->msg_data_);
diff --git a/ace/Log_Record.h b/ace/Log_Record.h
index 873da7bd5df..da54ebf42bb 100644
--- a/ace/Log_Record.h
+++ b/ace/Log_Record.h
@@ -57,29 +57,35 @@ public:
#if !defined (ACE_HAS_WINCE) // @@ Sould this be ACE_LACKS_IOSTREAM_TOTALLY?
int print (const ASYS_TCHAR host_name[],
- int verbose = 1,
+ u_long verbose_flag,
FILE *fp = stderr);
// Write the contents of the logging record to the appropriate
// <FILE>.
int print (const ASYS_TCHAR host_name[],
- int verbose,
+ u_long verbose_flag,
ostream &stream);
// Write the contents of the logging record to the appropriate
// <ostream>.
#else
int print (const ASYS_TCHAR host_name[],
- int verbose,
+ u_long verbose_flag,
FILE *fp);
// Write the contents of the logging record to the appropriate
// <FILE>.
int print (const ASYS_TCHAR host_name[],
- int verbose = 1,
+ u_long verbose_flag,
ACE_CE_Bridge *log_ = 0);
- // For Windows CE, the default is to log messages to a preset window.
+ // For Windows CE, the default is to log messages to a preset
+ // window.
#endif /* ! ACE_HAS_WINCE */
+ static const char *priority_name (ACE_Log_Priority p);
+ // Returns a character array with the string form of the
+ // <ACE_Log_Priority> parameter. This is used for the verbose
+ // printing format.
+
// = Marshall/demarshall
void encode (void);
// Encode the <Log_Record> for transmission on the network.
@@ -158,6 +164,9 @@ private:
ASYS_TCHAR msg_data_[MAXLOGMSGLEN];
// Logging record data
+
+ static const char *priority_names_[];
+ // Symbolic names for the <ACE_Log_Priority> enums.
};
#include "ace/Log_Record.i"
diff --git a/tests/test_config.h b/tests/test_config.h
index 08a3245d167..e48234a5785 100644
--- a/tests/test_config.h
+++ b/tests/test_config.h
@@ -94,7 +94,7 @@ typedef size_t KEY;
#define ACE_START_TEST(NAME) \
const char *program = NAME; \
- ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE); \
+ ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE); \
if (ace_file_stream.set_output (program) != 0) \
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "set_output failed"), -1); \
ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting %s test at %D\n", program))
@@ -105,7 +105,7 @@ typedef size_t KEY;
#define ACE_APPEND_LOG(NAME) \
const char *program = NAME; \
- ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE); \
+ ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE); \
ace_file_stream.close (); \
if (ace_file_stream.set_output (program, 1) != 0) \
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "set_output failed"), -1); \