[Libreoffice-commits] online.git: common/Log.hpp

2020-07-14 Thread Tor Lillqvist (via logerrit)
 common/Log.hpp |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 137981f3608ef29287eae4798e9f2880eaf8093b
Author: Tor Lillqvist 
AuthorDate: Tue Jul 14 16:43:07 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Tue Jul 14 16:52:28 2020 +0200

Add LOG_INF_NOFILE that doesn't display the source file location

Useful (like LOG_TRC_NOFILE) in cases where the source file location
of the LOG_INF call is uninteresting. (Like if the message to be
logged has originated somewhere else.)

Change-Id: Id6d8c137be073a958943f01b3d7b98143fcd7dfd
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98735
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/common/Log.hpp b/common/Log.hpp
index b2bb43860..64d215317 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -339,6 +339,16 @@ namespace Log
 }  
\
 } while (false)
 
+#define LOG_INF_NOFILE(X)  
\
+do 
\
+{  
\
+auto& log_ = Log::logger();
\
+if (log_.information() && !Log::isShutdownCalled())
\
+{  
\
+LOG_BODY_(log_, INFORMATION, "INF", X, false); 
\
+}  
\
+} while (false)
+
 #define LOG_WRN(X) 
\
 do 
\
 {  
\
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp wsd/Storage.cpp

2020-02-23 Thread Ashod Nakashian (via logerrit)
 common/Log.hpp  |  219 
 wsd/Storage.cpp |1 
 2 files changed, 113 insertions(+), 107 deletions(-)

New commits:
commit ddd3108767af2da6933044d182ca68c139141afe
Author: Ashod Nakashian 
AuthorDate: Wed Feb 19 22:00:08 2020 -0500
Commit: Ashod Nakashian 
CommitDate: Sun Feb 23 21:46:55 2020 +0100

wsd: logging improvements and formatting

Some multi-line log entries were missing
because we didn't flush.

Change-Id: Iabf9e6f1ffee707ff51b831a12c7990f35bb7913
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89196
Tested-by: Ashod Nakashian 
Reviewed-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index 495b4f0e9..35aaa0834 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -257,146 +257,153 @@ namespace Log
 #else
 // We know that when building with Xcode, __FILE__ will always be a full path, 
with several slashes,
 // so this will always work. We want just the file name, they are unique 
anyway.
-#define LOG_FILE_NAME(f) (strrchr(f, '/')+1)
+#define LOG_FILE_NAME(f) (strrchr(f, '/') + 1)
 #endif
 
-#define LOG_END(LOG, FILEP) \
-do  \
-{   \
-if (FILEP)  \
-LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; \
+#define LOG_END(LOG, FILEP)
\
+do 
\
+{  
\
+if (FILEP) 
\
+LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; 
\
+LOG.flush();   
\
 } while (false)
 
 #ifdef __ANDROID__
 
-#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
 \
-char b_[1024]; 
 \
-std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), 
std::ostringstream::ate); \
-oss_ << std::boolalpha << X;   
 \
-LOG_END(oss_, FILEP);  
 \
+#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
\
+char b_[1024]; 
\
+std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), 
std::ostringstream::ate);\
+oss_ << std::boolalpha << X;   
\
+LOG_END(oss_, FILEP);  
\
 ((void)__android_log_print(ANDROID_LOG_DEBUG, "loolwsd", "%s %s", LVL, 
oss_.str().c_str()))
 
 #else
 
-#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
 \
-Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);  
 \
-char b_[1024]; 
 \
-std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), 
std::ostringstream::ate); \
-oss_ << std::boolalpha << X;   
 \
-LOG_END(oss_, FILEP);  
 \
-m_.setText(oss_.str());
 \
+#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
\
+Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);  
\
+char b_[1024]; 
\
+std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), 
std::ostringstream::ate);\
+oss_ << std::boolalpha << X;   
\
+LOG_END(oss_, FILEP);  
\
+m_.setText(oss_.str());
\
 LOG.log(m_);
 
 #endif
 
-#define LOG_TRC(X)  \
-do  \
-{   \
-auto &log_ = Log::logger(); \
-if (!Log::isShutdownCalled() && log_.trace()) \
-{   \
-LOG_BODY_

[Libreoffice-commits] online.git: common/Log.hpp kit/Kit.cpp net/Socket.cpp wsd/LOOLWSD.cpp

2019-10-28 Thread Ashod Nakashian (via logerrit)
 common/Log.hpp  |2 +-
 kit/Kit.cpp |2 +-
 net/Socket.cpp  |7 +++
 wsd/LOOLWSD.cpp |1 +
 4 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a4a4d656322f69c9f7c6b5ac54f8c8baeacc5a86
Author: Ashod Nakashian 
AuthorDate: Sun Sep 29 23:32:45 2019 -0400
Commit: Michael Meeks 
CommitDate: Mon Oct 28 10:48:01 2019 +0100

wsd: logging improvements

Always log when we set the termination flag
so we can trace how (and implicitly why) we
terminated. In practice trace logging is not
enabled, so a key event such as termination
should be logged at info level.

Reviewed-on: https://gerrit.libreoffice.org/80324
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit 3f8d516e1399df687c2935fc551b171cbd850b7b)

Change-Id: Id6615181c81ea56777f44b551b39925065b0e578
Reviewed-on: https://gerrit.libreoffice.org/81562
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/common/Log.hpp b/common/Log.hpp
index df0a06536..495b4f0e9 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -233,7 +233,7 @@ namespace Log
 if (id != std::thread::id())
 {
 std::ostringstream os;
-os << std::hex << "0x" << id << std::dec;
+os << std::hex << "0x" << id;
 return os.str();
 }
 
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 4c59b8d79..d6d255bf1 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -2141,7 +2141,7 @@ protected:
 }
 else if (tokens[0] == "exit")
 {
-LOG_TRC("Setting TerminationFlag due to 'exit' command from 
parent.");
+LOG_INF("Setting TerminationFlag due to 'exit' command from 
parent.");
 SigUtil::getTerminationFlag() = true;
 document.reset();
 }
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 345e1d652..cf7087170 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -174,11 +174,9 @@ void SocketPoll::pollingThreadEntry()
 try
 {
 Util::setThreadName(_name);
-LOG_INF("Starting polling thread [" << _name << "].");
-
 _owner = std::this_thread::get_id();
-LOG_DBG("Thread affinity of " << _name << " set to " <<
-Log::to_string(_owner) << ".");
+LOG_INF("Starting polling thread [" << _name << "] with thread 
affinity set to "
+<< Log::to_string(_owner) << '.');
 
 // Invoke the virtual implementation.
 pollingThread();
@@ -193,6 +191,7 @@ void SocketPoll::pollingThreadEntry()
 }
 
 _threadFinished = true;
+LOG_INF("Finished polling thread [" << _name << "].");
 }
 
 void SocketPoll::wakeupWorld()
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ca0880812..d7ebcbb26 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1574,6 +1574,7 @@ void PrisonerPoll::wakeupHook()
 // block until the replay finishes
 replayThread->join();
 
+LOG_INF("Setting TerminationFlag");
 SigUtil::getTerminationFlag() = true;
 }
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: common/Log.hpp

2019-02-13 Thread Libreoffice Gerrit user
 common/Log.hpp |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit 73b93777f773bc2fc5543ab21562fd0e6bd16bac
Author: Jan Holesovsky 
AuthorDate: Wed Feb 13 16:08:01 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Wed Feb 13 16:08:01 2019 +0100

android: Implement logging to logcat.

Change-Id: I68d7861af019a24d9ecd80782cca38d09485345d

diff --git a/common/Log.hpp b/common/Log.hpp
index bf05fc7ce..f89300110 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -24,6 +24,10 @@
 #include 
 #include 
 
+#ifdef __ANDROID__
+#include 
+#endif
+
 #include "Util.hpp"
 
 inline std::ostream& operator<< (std::ostream& os, const Poco::Timestamp& ts)
@@ -240,6 +244,17 @@ namespace Log
 LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; \
 } while (false)
 
+#ifdef __ANDROID__
+
+#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
 \
+char b_[1024]; 
 \
+std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL), 
std::ostringstream::ate); \
+oss_ << std::boolalpha << X;   
 \
+LOG_END(oss_, FILEP);  
 \
+((void)__android_log_print(ANDROID_LOG_DEBUG, "libreoffice", "%s %s", LVL, 
oss_.str().c_str()))
+
+#else
+
 #define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
 \
 Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);  
 \
 char b_[1024]; 
 \
@@ -249,6 +264,8 @@ namespace Log
 m_.setText(oss_.str());
 \
 LOG.log(m_);
 
+#endif
+
 #define LOG_TRC(X)  \
 do  \
 {   \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: common/Log.hpp

2018-11-19 Thread Libreoffice Gerrit user
 common/Log.hpp |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e167cd173bd38b2e15285801a3af96ba9acbc001
Author: Miklos Vajna 
AuthorDate: Mon Nov 19 09:05:57 2018 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 19 09:06:10 2018 +0100

StreamLogger: make members private

Change-Id: Ie9ec09a9b7b8885bd97e62bd65df27cf1454c408

diff --git a/common/Log.hpp b/common/Log.hpp
index 755f90750..bf05fc7ce 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -110,9 +110,11 @@ namespace Log
 }
 }
 
-std::ostringstream _stream;
+std::ostringstream& getStream() { return _stream; }
 
 private:
+std::ostringstream _stream;
+
 std::function _func;
 const bool _enabled;
 };
@@ -164,7 +166,7 @@ namespace Log
 {
 if (lhs.enabled())
 {
-lhs._stream << rhs;
+lhs.getStream() << rhs;
 }
 
 return lhs;
@@ -175,7 +177,7 @@ namespace Log
 {
 if (lhs.enabled())
 {
-lhs._stream << rhs;
+lhs.getStream() << rhs;
 }
 
 return lhs;
@@ -185,7 +187,7 @@ namespace Log
 {
 if (lhs.enabled())
 {
-lhs._stream << Poco::DateTimeFormatter::format(Poco::DateTime(rhs),
+lhs.getStream() << 
Poco::DateTimeFormatter::format(Poco::DateTime(rhs),

Poco::DateTimeFormat::ISO8601_FRAC_FORMAT);
 }
 
@@ -215,7 +217,7 @@ namespace Log
 {
 if (lhs.enabled())
 {
-lhs._stream << Log::to_string(rhs);
+lhs.getStream() << Log::to_string(rhs);
 }
 
 return lhs;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp

2018-10-17 Thread Libreoffice Gerrit user
 common/Log.hpp |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 351193e1b76cae1e4e8bad0af94bac5b27ff8ae4
Author: Tor Lillqvist 
AuthorDate: Wed Oct 17 12:54:36 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Oct 17 12:54:36 2018 +0300

Don't bother logging the full pathname __FILE__ on iOS

diff --git a/common/Log.hpp b/common/Log.hpp
index 7aaf4174d..755f90750 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -223,11 +223,19 @@ namespace Log
 
 }
 
+#ifndef IOS
+#define LOG_FILE_NAME(f) f
+#else
+// We know that when building with Xcode, __FILE__ will always be a full path, 
with several slashes,
+// so this will always work. We want just the file name, they are unique 
anyway.
+#define LOG_FILE_NAME(f) (strrchr(f, '/')+1)
+#endif
+
 #define LOG_END(LOG, FILEP) \
 do  \
 {   \
 if (FILEP)  \
-LOG << "| " << __FILE__ << ':' << __LINE__; \
+LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; \
 } while (false)
 
 #define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
 \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp

2018-09-16 Thread Libreoffice Gerrit user
 common/Log.hpp |   19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 8d42e095591c8707a698ec58549a0994aa1a5faa
Author: Tor Lillqvist 
AuthorDate: Sun Sep 16 13:42:11 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Sun Sep 16 13:43:08 2018 +0300

Introduce LOG_TRC_NOFILE() that doesn't output __FILE__ and __LINE__

For use in callback type situations where the location of the
LOG_TRC() call as such is uninteresting.

diff --git a/common/Log.hpp b/common/Log.hpp
index cc60e4148..d0273965b 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -215,15 +215,16 @@ namespace Log
 
 }
 
-#define LOG_BODY_(PRIO, LVL, X) Poco::Message m_(l_.name(), "", 
Poco::Message::PRIO_##PRIO); char b_[1024]; std::ostringstream 
oss_(Log::prefix(b_, LVL, false), std::ostringstream::ate); oss_ << 
std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__; 
m_.setText(oss_.str()); l_.log(m_);
-#define LOG_TRC(X) do { auto& l_ = Log::logger(); if (l_.trace()) { 
LOG_BODY_(TRACE, "TRC", X); } } while (false)
-#define LOG_DBG(X) do { auto& l_ = Log::logger(); if (l_.debug()) { 
LOG_BODY_(DEBUG, "DBG", X); } } while (false)
-#define LOG_INF(X) do { auto& l_ = Log::logger(); if (l_.information()) { 
LOG_BODY_(INFORMATION, "INF", X); } } while (false)
-#define LOG_WRN(X) do { auto& l_ = Log::logger(); if (l_.warning()) { 
LOG_BODY_(WARNING, "WRN", X); } } while (false)
-#define LOG_ERR(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(ERROR, "ERR", X); } } while (false)
-#define LOG_SYS(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(ERROR, "ERR", X << " (" << Util::symbolicErrno(errno) << ": " << 
std::strerror(errno) << ")"); } } while (false)
-#define LOG_FTL(X) do { auto& l_ = Log::logger(); if (l_.fatal()) { 
LOG_BODY_(FATAL, "FTL", X); } } while (false)
-#define LOG_SFL(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(FATAL, "FTL", X << " (" << Util::symbolicErrno(errno) << ": " << 
std::strerror(errno) << ")"); } } while (false)
+#define LOG_BODY_(PRIO, LVL, X, FILEP) Poco::Message m_(l_.name(), "", 
Poco::Message::PRIO_##PRIO); char b_[1024]; std::ostringstream 
oss_(Log::prefix(b_, LVL, false), std::ostringstream::ate); oss_ << 
std::boolalpha << X; if (FILEP) oss_ << "| " << __FILE__ << ':' << __LINE__; 
m_.setText(oss_.str()); l_.log(m_);
+#define LOG_TRC(X) do { auto& l_ = Log::logger(); if (l_.trace()) { 
LOG_BODY_(TRACE, "TRC", X, true); } } while (false)
+#define LOG_TRC_NOFILE(X) do { auto& l_ = Log::logger(); if (l_.trace()) { 
LOG_BODY_(TRACE, "TRC", X, false); } } while (false)
+#define LOG_DBG(X) do { auto& l_ = Log::logger(); if (l_.debug()) { 
LOG_BODY_(DEBUG, "DBG", X, true); } } while (false)
+#define LOG_INF(X) do { auto& l_ = Log::logger(); if (l_.information()) { 
LOG_BODY_(INFORMATION, "INF", X, true); } } while (false)
+#define LOG_WRN(X) do { auto& l_ = Log::logger(); if (l_.warning()) { 
LOG_BODY_(WARNING, "WRN", X, true); } } while (false)
+#define LOG_ERR(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(ERROR, "ERR", X, true); } } while (false)
+#define LOG_SYS(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(ERROR, "ERR", X << " (" << Util::symbolicErrno(errno) << ": " << 
std::strerror(errno) << ")", true); } } while (false)
+#define LOG_FTL(X) do { auto& l_ = Log::logger(); if (l_.fatal()) { 
LOG_BODY_(FATAL, "FTL", X, true); } } while (false)
+#define LOG_SFL(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(FATAL, "FTL", X << " (" << Util::symbolicErrno(errno) << ": " << 
std::strerror(errno) << ")", true); } } while (false)
 
 #define LOG_END(l) do { l << "| " << __FILE__ << ':' << __LINE__; l.flush(); } 
while (false)
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp common/Seccomp.cpp common/Util.cpp

2018-08-29 Thread Libreoffice Gerrit user
 common/Log.hpp |3 +--
 common/Seccomp.cpp |1 +
 common/Util.cpp|1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 57326ae27cd9eb4a9a69b075395784836bbc9f99
Author: Tor Lillqvist 
AuthorDate: Wed Aug 29 18:32:48 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Aug 29 18:36:16 2018 +0300

Third parameter to prefix() is a bool

Passing syscall(SYS_gettid) as a bool is equivalent to passing true,
as far as I understand.

Change-Id: I31bb15000a9e6c95b657d58bc78df4f3da0fe687

diff --git a/common/Log.hpp b/common/Log.hpp
index 0ae6a2a7e..cc60e4148 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -10,7 +10,6 @@
 #ifndef INCLUDED_LOG_HPP
 #define INCLUDED_LOG_HPP
 
-#include 
 #include 
 
 #include 
@@ -83,7 +82,7 @@ namespace Log
 _enabled(true)
 {
 char buffer[1024];
-_stream << prefix(buffer, level, syscall(SYS_gettid));
+_stream << prefix(buffer, level, true);
 }
 
 StreamLogger(StreamLogger&& sl) noexcept
diff --git a/common/Seccomp.cpp b/common/Seccomp.cpp
index 3f363923a..2c77f35ed 100644
--- a/common/Seccomp.cpp
+++ b/common/Seccomp.cpp
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/common/Util.cpp b/common/Util.cpp
index a03cf4c46..e14412329 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp

2018-07-13 Thread Tor Lillqvist
 common/Log.hpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0c425c82d34ab1f719628b33c09aa5496b93fc88
Author: Tor Lillqvist 
Date:   Fri Jul 13 17:51:21 2018 +0300

Be consistent, no space before the '|' in LOG_BODY()

Change-Id: Iecab73efcb19562c5a7ebee506f13668b1a827c3

diff --git a/common/Log.hpp b/common/Log.hpp
index bfd1da8bd..1a4f69cdd 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -226,7 +226,7 @@ namespace Log
 #define LOG_FTL(X) do { auto& l_ = Log::logger(); if (l_.fatal()) { 
LOG_BODY_(FATAL, "FTL", X); } } while (false)
 #define LOG_SFL(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(FATAL, "FTL", X << " (" << Util::symbolicErrno(errno) << ": " << 
std::strerror(errno) << ")"); } } while (false)
 
-#define LOG_END(l) do { l << " | " << __FILE__ << ':' << __LINE__; l.flush(); 
} while (false)
+#define LOG_END(l) do { l << "| " << __FILE__ << ':' << __LINE__; l.flush(); } 
while (false)
 
 #define LOG_CHECK(X) do { if (!(X)) { LOG_ERR("Check failed. Expected (" #X 
")."); } } while (false)
 #define LOG_CHECK_RET(X, RET) do { if (!(X)) { LOG_ERR("Check failed. Expected 
(" #X ")."); return RET; } } while (false)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp common/Protocol.hpp common/Util.cpp net/Socket.hpp test/countloolkits.hpp test/helpers.hpp test/httpcrashtest.cpp test/httpwserror.cpp test/httpwstest.

2018-02-11 Thread Ashod Nakashian
 common/Log.hpp   |   25 +
 common/Protocol.hpp  |3 
 common/Util.cpp  |   11 +-
 net/Socket.hpp   |   23 ++---
 test/TileCacheTests.cpp  |4 
 test/countloolkits.hpp   |   13 +--
 test/helpers.hpp |  141 
 test/httpcrashtest.cpp   |   41 +
 test/httpwserror.cpp |4 
 test/httpwstest.cpp  |  168 ---
 test/integration-http-server.cpp |4 
 wsd/AdminModel.cpp   |6 -
 wsd/TileCache.cpp|6 -
 13 files changed, 268 insertions(+), 181 deletions(-)

New commits:
commit 7be98efd93be513b34f7d0a81d30a777902e90de
Author: Ashod Nakashian 
Date:   Mon Jan 22 09:11:43 2018 -0500

ut: log timestamp to track timeouts better

And improve the logging support in unit-tests to
help troubleshoot issues faster and more accurately.
Also makes the code more readable (hopefully).

Change-Id: I4f8aafb5245e2f774b03231591a74544f9ec84aa
Reviewed-on: https://gerrit.libreoffice.org/48645
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index a3e4a9ae..bb5a6155 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -187,6 +188,30 @@ namespace Log
 (void)end;
 lhs.flush();
 }
+
+/// Dump the invalid id as 0, otherwise dump in hex.
+inline std::string to_string(const std::thread::id& id)
+{
+if (id != std::thread::id())
+{
+std::ostringstream os;
+os << std::hex << "0x" << id << std::dec;
+return os.str();
+}
+
+return "0";
+}
+
+inline StreamLogger& operator<<(StreamLogger& lhs, const std::thread::id& 
rhs)
+{
+if (lhs.enabled())
+{
+lhs._stream << Log::to_string(rhs);
+}
+
+return lhs;
+}
+
 }
 
 #define LOG_BODY_(PRIO, LVL, X) Poco::Message m_(l_.name(), "", 
Poco::Message::PRIO_##PRIO); char b_[1024]; std::ostringstream 
oss_(Log::prefix(b_, LVL, false), std::ostringstream::ate); oss_ << 
std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__; 
m_.setText(oss_.str()); l_.log(m_);
diff --git a/common/Protocol.hpp b/common/Protocol.hpp
index 61f35b71..61e16d31 100644
--- a/common/Protocol.hpp
+++ b/common/Protocol.hpp
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -320,7 +321,7 @@ namespace LOOLProtocol
 result << Poco::format("%#x", flags);
 break;
 }
-result << " " << length << " bytes";
+result << " " << std::setw(3) << length << " bytes";
 
 if (length > 0 &&
 ((flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == 
Poco::Net::WebSocket::FRAME_OP_TEXT ||
diff --git a/common/Util.cpp b/common/Util.cpp
index 7605c5a3..7f320d38 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -453,13 +453,12 @@ namespace Util
 strncpy(ThreadName, s.c_str(), 31);
 ThreadName[31] = '\0';
 if (prctl(PR_SET_NAME, reinterpret_cast(s.c_str()), 0, 
0, 0) != 0)
-LOG_SYS("Cannot set thread name of " << getThreadId() << " (0x" <<
-std::hex << std::this_thread::get_id() <<
-std::dec << ") to [" << s << "].");
+LOG_SYS("Cannot set thread name of " << getThreadId() << " (" <<
+std::this_thread::get_id() << ") to [" << s << "].");
 else
-LOG_INF("Thread " << getThreadId() << " (0x" <<
-std::hex << std::this_thread::get_id() <<
-std::dec << ") is now called [" << s << "].");
+LOG_INF("Thread " << getThreadId() << " (" <<
+std::this_thread::get_id() <<
+") is now called [" << s << "].");
 }
 
 const char *getThreadName()
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 7e5035b4..bec3744d 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -242,8 +242,8 @@ public:
 {
 if (id != _owner)
 {
-LOG_DBG("#" << _fd << " Thread affinity set to 0x" << std::hex <<
-id << " (was 0x" << _owner << ")." << std::dec);
+LOG_DBG("#" << _fd << " Thread affinity set to " << 
Log::to_string(id) <<
+" (was " << Log::to_string(_owner) << ").");
 _owner = id;
 }
 }
@@ -261,9 +261,9 @@ public:
 // 0 owner means detached and can be invoked by any thread.
 const bool sameThread = (_owner == std::thread::id(0) || 
std::this_thread::get_id() == _owner);
 if (!sameThread)
-LOG_ERR("#" << _fd << " Invoked from foreign thread. Expected: 0x" 
<< std::hex <<
-_owner << " but called from 0x" << 
std::this_thread::get_id() << " (" <<

[Libreoffice-commits] online.git: common/Log.hpp wsd/DocumentBroker.cpp wsd/Storage.cpp

2017-06-16 Thread Pranav Kant
 common/Log.hpp |   14 ++
 wsd/DocumentBroker.cpp |   18 +-
 wsd/Storage.cpp|   10 +++---
 3 files changed, 30 insertions(+), 12 deletions(-)

New commits:
commit db13014e00358303f577518c96e29e23e544c1a8
Author: Pranav Kant 
Date:   Sat Jun 10 20:15:00 2017 +0530

Update modifiedTime for local files unconditionally

Also teach logger to print timestamp object.

Change-Id: Ia13836814c195cef92f5dafd8245c9958600876d

diff --git a/common/Log.hpp b/common/Log.hpp
index 21de30f6..0be4983f 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -17,6 +17,9 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
 #include 
 
 namespace Log
@@ -170,6 +173,17 @@ namespace Log
 return lhs;
 }
 
+inline StreamLogger& operator<<(StreamLogger& lhs, const Poco::Timestamp& 
rhs)
+{
+if (lhs.enabled())
+{
+lhs._stream <<  
Poco::DateTimeFormatter::format(Poco::DateTime(rhs),
+
Poco::DateTimeFormat::ISO8601_FRAC_FORMAT);
+}
+
+return lhs;
+}
+
 inline void operator<<(StreamLogger& lhs, const _end_marker&)
 {
 (void)end;
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index d4ac586a..fd04998a 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -510,21 +510,21 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 if (firstInstance)
 {
 _documentLastModifiedTime = fileInfo._modifiedTime;
-LOG_DBG("Document timestamp: " << 
Poco::DateTimeFormatter::format(Poco::DateTime(_documentLastModifiedTime),
-  
Poco::DateTimeFormat::ISO8601_FORMAT));
+Log::debug() << "Document timestamp: " << _documentLastModifiedTime << 
Log::end;
 }
 else
 {
 // Check if document has been modified by some external action
-LOG_TRC("Document modified time: " <<
-
Poco::DateTimeFormatter::format(Poco::DateTime(fileInfo._modifiedTime),
-
Poco::DateTimeFormat::ISO8601_FORMAT));
+Log::trace() << "Document modified time: " << fileInfo._modifiedTime 
<< Log::end;
 static const Poco::Timestamp Zero(Poco::Timestamp::fromEpochTime(0));
 if (_documentLastModifiedTime != Zero &&
 fileInfo._modifiedTime != Zero &&
 _documentLastModifiedTime != fileInfo._modifiedTime)
 {
-LOG_WRN("Document [" << _docKey << "] has been modified behind our 
back. Informing all clients.");
+Log::trace() << "Document " << _docKey << "] has been modified 
behind our back. Informing all clients."
+ << "Expected: " << _documentLastModifiedTime
+ << "Actual: " << fileInfo._modifiedTime << Log::end;
+
 _documentChangedInStorage = true;
 const std::string errorMsg = "error: cmd=storage 
kind=documentconflict";
 session->sendTextFrame(errorMsg);
@@ -658,9 +658,9 @@ bool DocumentBroker::saveToStorageInternal(const 
std::string& sessionId,
 // After a successful save, we are sure that document in the storage 
is same as ours
 _documentChangedInStorage = false;
 
-LOG_DBG("Saved docKey [" << _docKey << "] to URI [" << uri << "] and 
updated tile cache. Document modified timestamp: " <<
-
Poco::DateTimeFormatter::format(Poco::DateTime(_documentLastModifiedTime),
-   
Poco::DateTimeFormat::ISO8601_FORMAT));
+Log::debug() << "Saved docKey [" << _docKey << "] to URI [" << uri
+ << "] and updated tile cache. Document modified 
timestamp: "
+ << _documentLastModifiedTime << Log::end;
 return true;
 }
 else if (storageSaveResult == StorageBase::SaveResult::DISKFULL)
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index af31674e..bc205446 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -286,16 +286,20 @@ StorageBase::SaveResult 
LocalStorage::saveLocalFileToStorage(const std::string&
 {
 try
 {
+LOG_TRC("Saving local file to local file storage " << _isCopy << " for 
" << _jailedFilePath);
 // Copy the file back.
 if (_isCopy && Poco::File(_jailedFilePath).exists())
 {
 LOG_INF("Copying " << _jailedFilePath << " to " << _uri.getPath());
 Poco::File(_jailedFilePath).copyTo(_uri.getPath());
 
-// update its fileinfo object. This is used later to check if 
someone else changed the
-// document while we are/were editing it
-_fileInfo._modifiedTime = 
Poco::File(_uri.getPath()).getLastModified();
+
 }
+
+// update its fileinfo object. This is used later to check if someone 
else changed the
+// document while we are/w

[Libreoffice-commits] online.git: common/Log.hpp wsd/LOOLWSD.cpp wsd/Storage.cpp

2017-03-11 Thread Ashod Nakashian
 common/Log.hpp  |2 ++
 wsd/LOOLWSD.cpp |   42 --
 wsd/Storage.cpp |   12 ++--
 3 files changed, 32 insertions(+), 24 deletions(-)

New commits:
commit e9614fc697ae3d38ca83a7ce2bcea8cea536e481
Author: Ashod Nakashian 
Date:   Sat Mar 11 14:42:34 2017 -0500

wsd: support logging file and line with logger objects

Change-Id: Ibf82105d91ece29c0a4742c6b2e81f6b179c0be4
Reviewed-on: https://gerrit.libreoffice.org/35081
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index e4cc34d..2ad4e5d 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -185,6 +185,8 @@ namespace Log
 #define LOG_FTL(X) do { auto& l_ = Log::logger(); if (l_.fatal()) { 
LOG_BODY_(FATAL, "FTL", X); } } while (false)
 #define LOG_SFL(X) do { auto& l_ = Log::logger(); if (l_.error()) { 
LOG_BODY_(FATAL, "FTL", X << " (errno: " << std::strerror(errno) << ")"); } } 
while (false)
 
+#define LOG_END(l) do { l << __FILE__ << ':' << __LINE__; l.flush(); } while 
(false)
+
 #define LOG_CHECK(X) do { if (!(X)) { LOG_ERR("Check failed. Expected (" #X 
")."); } } while (false)
 #define LOG_CHECK_RET(X, RET) do { if (!(X)) { LOG_ERR("Check failed. Expected 
(" #X ")."); return RET; } } while (false)
 
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index cdf6518..eb06f5f 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1508,17 +1508,20 @@ private:
 request.read(message);
 
 auto logger = Log::info();
-// logger << "Request from " << request.clientAddress().toString() 
<< ": "
-logger << "Prisoner request : "
-   << request.getMethod() << " " << request.getURI() << " "
-   << request.getVersion();
-
-for (const auto& it : request)
+if (logger.enabled())
 {
-logger << " / " << it.first << ": " << it.second;
-}
+logger << "Prisoner HTTP Request: "
+   << request.getMethod() << ' '
+   << request.getURI() << ' '
+   << request.getVersion();
+
+for (const auto& it : request)
+{
+logger << " / " << it.first << ": " << it.second;
+}
 
-logger << Log::end;
+LOG_END(logger);
+}
 
 LOG_TRC("Child connection with URI [" << request.getURI() << "].");
 if (request.getURI().find(NEW_CHILD_URI) != 0)
@@ -1678,17 +1681,20 @@ private:
 request.read(message);
 
 auto logger = Log::info();
-// logger << "Request from " << request.clientAddress().toString() 
<< ": "
-logger << "Request : "
-   << request.getMethod() << " " << request.getURI() << " "
-   << request.getVersion();
-
-for (const auto& it : request)
+if (logger.enabled())
 {
-logger << " / " << it.first << ": " << it.second;
-}
+logger << "Client HTTP Request: "
+   << request.getMethod() << ' '
+   << request.getURI() << ' '
+   << request.getVersion();
+
+for (const auto& it : request)
+{
+logger << " / " << it.first << ": " << it.second;
+}
 
-logger << Log::end;
+LOG_END(logger);
+}
 
 const std::streamsize contentLength = request.getContentLength();
 const auto offset = itBody - in.begin();
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 8e7868f..9d2f991 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -379,16 +379,16 @@ std::unique_ptr 
WopiStorage::getWOPIFileInfo(const Po
 std::istream& rs = psession->receiveResponse(response);
 callDuration = (std::chrono::steady_clock::now() - startTime);
 
-if (Log::traceEnabled())
+auto logger = Log::trace();
+if (logger.enabled())
 {
-auto logger = Log::trace();
 logger << "WOPI::CheckFileInfo header for URI [" << 
uriPublic.toString() << "]:\n";
 for (const auto& pair : response)
 {
 logger << '\t' << pair.first << ": " << pair.second << " / ";
 }
 
-logger << Log::end;
+LOG_END(logger);
 }
 
 Poco::StreamCopier::copyToString(rs, resMsg);
@@ -496,16 +496,16 @@ std::string WopiStorage::loadStorageFileToLocal()
 const std::chrono::duration diff = 
(std::chrono::steady_clock::now() - startTime);
 _wopiLoadDuration += diff;
 
-if (Log::traceEnabled())
+auto logger = Log::trace();
+if (logger.enabled())
 {
-auto logger = Log::trace();
 logger << "WOPI::GetFile header for URI [" << uriObject.toString() 
<< 

[Libreoffice-commits] online.git: common/Log.hpp

2017-02-03 Thread Ashod Nakashian
 common/Log.hpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 386dc679a5313fa18cd35686e061781d7d5c3d45
Author: Ashod Nakashian 
Date:   Fri Feb 3 11:01:07 2017 -0500

wsd: get system thread-id directly as not in Poco yet

Change-Id: I49ba23b6cd50c2d9058e9803d7f65ec41277297b
Reviewed-on: https://gerrit.libreoffice.org/33890
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index d8788a2..e4cc34d 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -175,7 +175,7 @@ namespace Log
 }
 }
 
-#define LOG_BODY_(PRIO, LVL, X) Poco::Message m_(l_.name(), "", 
Poco::Message::PRIO_##PRIO); char b_[1024]; std::ostringstream 
oss_(Log::prefix(b_, LVL, m_.getOsTid()), std::ostringstream::ate); oss_ << 
std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__; 
m_.setText(oss_.str()); l_.log(m_);
+#define LOG_BODY_(PRIO, LVL, X) Poco::Message m_(l_.name(), "", 
Poco::Message::PRIO_##PRIO); char b_[1024]; std::ostringstream 
oss_(Log::prefix(b_, LVL, syscall(SYS_gettid)), std::ostringstream::ate); oss_ 
<< std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__; 
m_.setText(oss_.str()); l_.log(m_);
 #define LOG_TRC(X) do { auto& l_ = Log::logger(); if (l_.trace()) { 
LOG_BODY_(TRACE, "TRC", X); } } while (false)
 #define LOG_DBG(X) do { auto& l_ = Log::logger(); if (l_.debug()) { 
LOG_BODY_(DEBUG, "DBG", X); } } while (false)
 #define LOG_INF(X) do { auto& l_ = Log::logger(); if (l_.information()) { 
LOG_BODY_(INFORMATION, "INF", X); } } while (false)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp test/test.cpp

2017-01-16 Thread Tor Lillqvist
 common/Log.hpp |8 
 test/test.cpp  |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 32b92dcd912cb7330e91508bed3b7a71a67fd53b
Author: Tor Lillqvist 
Date:   Mon Jan 16 14:04:15 2017 +0200

Bin default values for parameters that were defaulted at just one call site

Change-Id: I965b0be1ad4f706a06d06d5c6c3f940c1b3cc33c

diff --git a/common/Log.hpp b/common/Log.hpp
index c068629..b4d42c7 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -19,10 +19,10 @@
 namespace Log
 {
 void initialize(const std::string& name,
-const std::string& logLevel = "trace",
-const bool withColor = true,
-const bool logToFile = false,
-std::map config = {});
+const std::string& logLevel,
+const bool withColor,
+const bool logToFile,
+std::map config);
 Poco::Logger& logger();
 std::string prefix(const char* level);
 
diff --git a/test/test.cpp b/test/test.cpp
index 0f8b359..0d30f3a 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -56,7 +56,7 @@ bool filterTests(CPPUNIT_NS::TestRunner& runner, 
CPPUNIT_NS::Test* testRegistry,
 
 int main(int /*argc*/, char** /*argv*/)
 {
-Log::initialize("tst");
+Log::initialize("tst", "trace", true, false, {});
 
 CPPUNIT_NS::TestResult controller;
 CPPUNIT_NS::TestResultCollector result;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp

2017-01-04 Thread Tor Lillqvist
 common/Log.hpp |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit ae6f0e3df91f3b50c8bb3a1c3923e6fed798be0c
Author: Tor Lillqvist 
Date:   Wed Jan 4 16:09:04 2017 +0200

Make it possible to use the LOG_* things as statements

Use the usual do { ... } while (false) idiom. (See
http://stackoverflow.com/questions/4674480/do-whilefalse-pattern for
instance.)

Change-Id: I1fb00c331ab4eab3ebbff1d58a8ed36e59d2646c

diff --git a/common/Log.hpp b/common/Log.hpp
index 4613877..c068629 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -171,17 +171,17 @@ namespace Log
 }
 
 #define LOG_BODY(LVL, X) std::ostringstream oss_; oss_ << Log::prefix(LVL) << 
std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__
-#define LOG_TRC(X) if (Log::traceEnabled()) { LOG_BODY("TRC", X); 
Log::logger().trace(oss_.str()); }
-#define LOG_DBG(X) if (Log::debugEnabled()) { LOG_BODY("DBG", X); 
Log::logger().debug(oss_.str()); }
-#define LOG_INF(X) if (Log::infoEnabled()) { LOG_BODY("INF", X); 
Log::logger().information(oss_.str()); }
-#define LOG_WRN(X) if (Log::warnEnabled()) { LOG_BODY("WRN", X); 
Log::logger().warning(oss_.str()); }
-#define LOG_ERR(X) if (Log::errorEnabled()) { LOG_BODY("ERR", X); 
Log::logger().error(oss_.str()); }
-#define LOG_SYS(X) if (Log::errorEnabled()) { LOG_BODY("ERR", X << " (errno: " 
<< std::strerror(errno) << ")"); Log::logger().error(oss_.str()); }
-#define LOG_FTL(X) if (Log::fatalEnabled()) { LOG_BODY("FTL", X); 
Log::logger().fatal(oss_.str()); }
-#define LOG_SFL(X) if (Log::errorEnabled()) { LOG_BODY("FTL", X << " (errno: " 
<< std::strerror(errno) << ")"); Log::logger().fatal(oss_.str()); }
-
-#define LOG_CHECK(X) if (!(X)) { LOG_ERR("Check failed. Expected (" #X ")."); }
-#define LOG_CHECK_RET(X, RET) if (!(X)) { LOG_ERR("Check failed. Expected (" 
#X ")."); return RET; }
+#define LOG_TRC(X) do { if (Log::traceEnabled()) { LOG_BODY("TRC", X); 
Log::logger().trace(oss_.str()); } } while (false)
+#define LOG_DBG(X) do { if (Log::debugEnabled()) { LOG_BODY("DBG", X); 
Log::logger().debug(oss_.str()); } } while (false)
+#define LOG_INF(X) do { if (Log::infoEnabled()) { LOG_BODY("INF", X); 
Log::logger().information(oss_.str()); } } while (false)
+#define LOG_WRN(X) do { if (Log::warnEnabled()) { LOG_BODY("WRN", X); 
Log::logger().warning(oss_.str()); } } while (false)
+#define LOG_ERR(X) do { if (Log::errorEnabled()) { LOG_BODY("ERR", X); 
Log::logger().error(oss_.str()); } } while (false)
+#define LOG_SYS(X) do { if (Log::errorEnabled()) { LOG_BODY("ERR", X << " 
(errno: " << std::strerror(errno) << ")"); Log::logger().error(oss_.str()); } } 
while (false)
+#define LOG_FTL(X) do { if (Log::fatalEnabled()) { LOG_BODY("FTL", X); 
Log::logger().fatal(oss_.str()); } } while (false)
+#define LOG_SFL(X) do { if (Log::errorEnabled()) { LOG_BODY("FTL", X << " 
(errno: " << std::strerror(errno) << ")"); Log::logger().fatal(oss_.str()); } } 
while (false)
+
+#define LOG_CHECK(X) do { if (!(X)) { LOG_ERR("Check failed. Expected (" #X 
")."); } } while (false)
+#define LOG_CHECK_RET(X, RET) do { if (!(X)) { LOG_ERR("Check failed. Expected 
(" #X ")."); return RET; } } while (false)
 
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp

2016-12-31 Thread Ashod Nakashian
 common/Log.hpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 92bbe0b774778c27a6525700026f424c148a0b26
Author: Ashod Nakashian 
Date:   Thu Dec 22 19:32:46 2016 -0500

wsd: log bools as text

Change-Id: I0d520671704881bf1aaeb090ce452be74e43fd0c
Reviewed-on: https://gerrit.libreoffice.org/32561
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index f4ba714..4613877 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -170,7 +170,7 @@ namespace Log
 }
 }
 
-#define LOG_BODY(LVL, X) std::ostringstream oss_; oss_ << Log::prefix(LVL) << 
X << "| " << __FILE__ << ':' << __LINE__
+#define LOG_BODY(LVL, X) std::ostringstream oss_; oss_ << Log::prefix(LVL) << 
std::boolalpha << X << "| " << __FILE__ << ':' << __LINE__
 #define LOG_TRC(X) if (Log::traceEnabled()) { LOG_BODY("TRC", X); 
Log::logger().trace(oss_.str()); }
 #define LOG_DBG(X) if (Log::debugEnabled()) { LOG_BODY("DBG", X); 
Log::logger().debug(oss_.str()); }
 #define LOG_INF(X) if (Log::infoEnabled()) { LOG_BODY("INF", X); 
Log::logger().information(oss_.str()); }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: common/Log.hpp common/Session.cpp

2016-12-31 Thread Ashod Nakashian
 common/Log.hpp |1 +
 common/Session.cpp |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9e677e268f7e4456da5d568e6a5a75fabb887ca7
Author: Ashod Nakashian 
Date:   Wed Dec 21 18:15:27 2016 -0500

wsd: new LOG_CHECK_RET to log failure and return

This is to replace assertion for non-fatal cases.

Change-Id: I6f8aedea52fb861309d0bc8f8f9cd43395da0805
Reviewed-on: https://gerrit.libreoffice.org/32550
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/common/Log.hpp b/common/Log.hpp
index ee7dc55..f4ba714 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -181,6 +181,7 @@ namespace Log
 #define LOG_SFL(X) if (Log::errorEnabled()) { LOG_BODY("FTL", X << " (errno: " 
<< std::strerror(errno) << ")"); Log::logger().fatal(oss_.str()); }
 
 #define LOG_CHECK(X) if (!(X)) { LOG_ERR("Check failed. Expected (" #X ")."); }
+#define LOG_CHECK_RET(X, RET) if (!(X)) { LOG_ERR("Check failed. Expected (" 
#X ")."); return RET; }
 
 #endif
 
diff --git a/common/Session.cpp b/common/Session.cpp
index 0e51de5..afebb3b 100644
--- a/common/Session.cpp
+++ b/common/Session.cpp
@@ -217,7 +217,7 @@ void Session::shutdown(Poco::UInt16 statusCode, const 
std::string& statusMessage
 
 bool Session::handleInput(const char *buffer, int length)
 {
-assert(buffer != nullptr);
+LOG_CHECK_RET(buffer != nullptr, false);
 
 try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits