[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h |
Date: |
Fri, 28 Mar 2008 15:22:07 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/03/28 15:22:07
Modified files:
. : ChangeLog
libbase : log.cpp log.h
Log message:
simplify logging path.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6059&r2=1.6060
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.73&r2=1.74
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6059
retrieving revision 1.6060
diff -u -b -r1.6059 -r1.6060
--- ChangeLog 28 Mar 2008 15:13:33 -0000 1.6059
+++ ChangeLog 28 Mar 2008 15:22:06 -0000 1.6060
@@ -1,3 +1,7 @@
+2008-03-28 Sandro Santilli <address@hidden>
+
+ * libbase/log.{cpp,h}: simplify logging path.
+
2008-03-28 Benjamin Wolsey <address@hidden>
* libbase/utf8.h: minor comment update.
Index: libbase/log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- libbase/log.cpp 28 Mar 2008 10:32:28 -0000 1.70
+++ libbase/log.cpp 28 Mar 2008 15:22:07 -0000 1.71
@@ -198,14 +198,28 @@
LogFile::log(const std::string& msg)
{
boost::mutex::scoped_lock lock(_ioMutex);
- dbglogfile << msg << endl;
+
+ if (_stamp == true )
+ {
+ std::string ts = timestamp();
+ if (_verbose) cout << ts << " " << msg << endl;
+ if (openLogIfNeeded()) {
+ _outstream << ts << ": " << msg << endl;
+ }
+ }
+ else
+ {
+ if (_verbose) cout << msg << endl;
+ if (openLogIfNeeded()) {
+ _outstream << msg << endl;
+ }
+ }
}
void
LogFile::log(const std::string& label, const std::string& msg)
{
- boost::mutex::scoped_lock lock(_ioMutex);
- dbglogfile << label << ": " << msg << endl;
+ log(label+std::string(": ")+msg);
}
void
@@ -311,51 +325,6 @@
return true;
}
-/// log a string
-LogFile&
-LogFile::operator << (const std::string &s)
-{
- // NOTE: _state will be == INPROGRESS right
-
- if (_stamp == true && (_state != INPROGRESS) )
- {
- std::string ts = timestamp();
-
- if (_verbose) cout << ts << ": " << s;
- if (openLogIfNeeded())
- {
- _outstream << ts << ": " << s;
- }
- _state = INPROGRESS;
- }
- else
- {
- if (_verbose) cout << s;
- if (openLogIfNeeded()) {
- _outstream << s;
- }
- }
- return *this;
-}
-
-/// \brief Grab the endl operator.
-LogFile&
-LogFile::operator << (std::ostream & (&)(std::ostream &))
-{
-
- if (_verbose) cout << endl;
-
- if (openLogIfNeeded())
- {
- _outstream << endl;;
- _outstream.flush();
- }
-
- _state = IDLE;
-
- return *this;
-}
-
boost::format
logFormat (const std::string &str)
{
Index: libbase/log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- libbase/log.h 26 Mar 2008 22:54:38 -0000 1.73
+++ libbase/log.h 28 Mar 2008 15:22:07 -0000 1.74
@@ -218,23 +218,6 @@
/// For the ostream << operator
friend std::ostream & operator << (std::ostream &os, LogFile& e);
- LogFile& operator << (const std::string &s);
- LogFile& operator << (std::ostream & (&)(std::ostream &));
-
- /// Print anything that can be printed on a stringstream
- //
- /// This template function could replace ALL but
- /// operator << (const std::string&) members of
- /// LogFile class.
- ///
- template <class T>
- LogFile& operator << (const T& any)
- {
- std::stringstream ss;
- ss << any;
- return *this << ss.str();
- }
-
std::string _logFilename;
};