configure.ac                 |   12 ++++++++++++
 loleaflet/src/core/Socket.js |   18 ++++++++----------
 loolwsd.xml.in               |    2 +-
 3 files changed, 21 insertions(+), 11 deletions(-)

New commits:
commit fa14102b3bd3ad3f9a305cc12fefe44dd2ec4e19
Author:     Michael Meeks <[email protected]>
AuthorDate: Thu Mar 26 11:38:00 2020 +0000
Commit:     Michael Meeks <[email protected]>
CommitDate: Thu Mar 26 19:35:04 2020 +0100

    Restore Javascript protocol logging.
    
    If you don't want protocol logging by default in debugging builds
    then either poke loolwsd.xml:
    
    <protocol type="bool" descr="Enable minimal client-site JS protocol logging 
from the start">false</protocol>
    
    Or - configure with --disable-debug and --disable-debug-protocol.
    
    Also remove redundant and unused co-ordinate parameters to the
    message queue, and logging.
    
    Change-Id: I489e32ef4758a6f0ef35c8d8d322a402a3e268e6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91096
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Meeks <[email protected]>

diff --git a/configure.ac b/configure.ac
index d6f4316ef..1edd5408f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,11 @@ AC_ARG_ENABLE([debug],
               AS_HELP_STRING([--enable-debug],
                              [Enable debugging, link with debugging version of 
Poco libraries]))
 
+AC_ARG_ENABLE([debug-protocol],
+    AS_HELP_STRING([--disable-debug-protocol],
+        [Disables JS protocol logging by default, otherwise it is slaved to 
enable-debug.])
+)
+
 AC_ARG_ENABLE([browsersync],
               AS_HELP_STRING([--enable-browsersync],
                              [Don't copy files to the target directory but 
create the symlink to allow browsersync usage]))
@@ -283,6 +288,7 @@ AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"],
       [POCO_DEBUG_SUFFIX=])
 
 ENABLE_DEBUG=false
+ENABLE_DEBUG_PROTOCOL=false
 LOOLWSD_LOGLEVEL="warning"
 LOOLWSD_LOG_TO_FILE="false"
 LOOLWSD_LOGFILE="/var/log/loolwsd.log"
@@ -293,6 +299,7 @@ anonym_msg=""
 if test "$enable_debug" = "yes"; then
    AC_DEFINE([ENABLE_DEBUG],1,[Whether to compile in some extra debugging 
support code and disable some security pieces])
    ENABLE_DEBUG=true
+   ENABLE_DEBUG_PROTOCOL=true
    LOOLWSD_LOGLEVEL="trace"
    LOOLWSD_LOG_TO_FILE="true"
    LOOLWSD_LOGFILE="/tmp/loolwsd.log"
@@ -307,6 +314,11 @@ AC_SUBST(LOOLWSD_LOGLEVEL)
 AC_SUBST(LOOLWSD_LOG_TO_FILE)
 AC_SUBST(LOLEAFLET_LOGGING)
 
+if test "$enable_debug_protocol" = no; then
+   ENABLE_DEBUG_PROTOCOL=false
+fi
+AC_SUBST(ENABLE_DEBUG_PROTOCOL)
+
 ENABLE_BROWSERSYNC=
 browsersync_msg="disabled: copy files to the target directory"
 if test "$enable_browsersync" = "yes"; then
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index d744f4b46..d4e76d4e4 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -120,7 +120,7 @@ L.Socket = L.Class.extend({
                return this.socket && this.socket.readyState === 1;
        },
 
-       sendMessage: function (msg, coords) {
+       sendMessage: function (msg) {
                if (this._map._fatal) {
                        // Avoid communicating when we're in fatal state
                        return;
@@ -145,16 +145,14 @@ L.Socket = L.Class.extend({
                }
                else {
                        // push message while trying to connect socket again.
-                       this._msgQueue.push({msg: msg, coords: coords});
+                       this._msgQueue.push(msg);
                }
        },
 
-       _doSend: function(msg, coords) {
+       _doSend: function(msg) {
                // Only attempt to log text frames, not binary ones.
-               if (typeof msg === 'string') {
-                       L.Log.log(msg, 'OUTGOING', coords);
-                       // this._logSocket('OUTGOING', msg);
-               }
+               if (typeof msg === 'string')
+                       this._logSocket('OUTGOING', msg);
 
                this.socket.send(msg);
        },
@@ -197,7 +195,7 @@ L.Socket = L.Class.extend({
                }
                this._doSend(msg);
                for (var i = 0; i < this._msgQueue.length; i++) {
-                       this._doSend(this._msgQueue[i].msg, 
this._msgQueue[i].coords);
+                       this._doSend(this._msgQueue[i]);
                }
                this._msgQueue = [];
 
@@ -268,7 +266,7 @@ L.Socket = L.Class.extend({
                        textMsg = String.fromCharCode.apply(null, 
imgBytes.subarray(0, index));
                }
 
-               // this._logSocket('INCOMING', textMsg);
+               this._logSocket('INCOMING', textMsg);
 
                var command = this.parseServerCmd(textMsg);
                if (textMsg.startsWith('loolserver ')) {
@@ -759,7 +757,7 @@ L.Socket = L.Class.extend({
                }
                else if (!textMsg.startsWith('tile:') && 
!textMsg.startsWith('renderfont:') && !textMsg.startsWith('windowpaint:')) {
                        // log the tile msg separately as we need the tile 
coordinates
-                       L.Log.log(textMsg, 'INCOMING');
+                       this._logSocket('INCOMING', textMsg);
 
                        if (imgBytes !== undefined) {
                                try {
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 80276ec40..a8442c91e 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -41,7 +41,7 @@
     <logging>
         <color type="bool">true</color>
         <level type="string" desc="Can be 0-8, or none (turns off logging), 
fatal, critical, error, warning, notice, information, debug, trace" 
default="@LOOLWSD_LOGLEVEL@">@LOOLWSD_LOGLEVEL@</level>
-        <protocol type="bool" descr="Enable minimal client-site JS protocol 
logging from the start">@ENABLE_DEBUG@</protocol>
+        <protocol type="bool" descr="Enable minimal client-site JS protocol 
logging from the start">@ENABLE_DEBUG_PROTOCOL@</protocol>
         <file enable="@LOOLWSD_LOG_TO_FILE@">
             <property name="path" desc="Log file 
path.">@LOOLWSD_LOGFILE@</property>
             <property name="rotation" desc="Log file rotation strategy. See 
Poco FileChannel.">never</property>
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to