browser console logging depending on loleaflet_logging prop.
loleaflet_logging defaults to true with compiled with --enable-debug otherwise false. Browser will print additional debug info when this property is set to true. Change-Id: Id9fabf134bd8d19fa1a09ca8c0987df46d4f1a4cfeature/deduplication
parent
6c4472de1d
commit
39dd5018e2
|
@ -109,6 +109,7 @@ ENABLE_DEBUG=
|
|||
LOOLWSD_LOGLEVEL="warning"
|
||||
LOOLWSD_LOG_TO_FILE="false"
|
||||
LOOLWSD_LOGFILE="/var/log/loolwsd.log"
|
||||
LOLEAFLET_LOGGING="false"
|
||||
debug_msg="secure mode: product build"
|
||||
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])
|
||||
|
@ -116,6 +117,7 @@ if test "$enable_debug" = "yes"; then
|
|||
LOOLWSD_LOGLEVEL="trace"
|
||||
LOOLWSD_LOG_TO_FILE="true"
|
||||
LOOLWSD_LOGFILE="/tmp/loolwsd.log"
|
||||
LOLEAFLET_LOGGING="true"
|
||||
debug_msg="low security debugging mode"
|
||||
else
|
||||
AC_DEFINE([ENABLE_DEBUG],0,[Whether to compile in some extra debugging support code and disable some security pieces])
|
||||
|
@ -123,6 +125,7 @@ fi
|
|||
AC_SUBST(ENABLE_DEBUG)
|
||||
AC_SUBST(LOOLWSD_LOGLEVEL)
|
||||
AC_SUBST(LOOLWSD_LOG_TO_FILE)
|
||||
AC_SUBST(LOLEAFLET_LOGGING)
|
||||
|
||||
if test -n "$with_logfile" ; then
|
||||
LOOLWSD_LOGFILE="$with_logfile"
|
||||
|
@ -324,4 +327,3 @@ echo " \$ make run # to start loolwsd
|
|||
fi
|
||||
|
||||
dnl vim:set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
window.host = '%HOST%';
|
||||
window.access_token = '%ACCESS_TOKEN%';
|
||||
window.access_token_ttl = '%ACCESS_TOKEN_TTL%';
|
||||
window.loleaflet_logging = '%LOLEAFLET_LOGGING%';
|
||||
</script>
|
||||
<script src="/loleaflet/%VERSION%/branding.js"></script> <!-- logo onclick handler -->
|
||||
<script src="/loleaflet/%VERSION%/bundle.js"></script>
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
// If not debug, don't print anything on the console
|
||||
if (loleaflet_logging !== 'true') {
|
||||
var methods = ['warn', 'info', 'debug', 'trace', 'log', 'assert', 'time', 'timeEnd'];
|
||||
for (var i = 0; i < methods.length; i++) {
|
||||
console[methods[i]] = function() {};
|
||||
}
|
||||
}
|
||||
|
||||
// Include our main css file
|
||||
require('./main.css');
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
</file>
|
||||
</logging>
|
||||
|
||||
<loleaflet_logging desc="Logging in the browser console" default="@LOLEAFLET_LOGGING@">@LOLEAFLET_LOGGING@</loleaflet_logging>
|
||||
|
||||
<trace desc="Dump commands and notifications for replay" enable="true">
|
||||
<path desc="Output file path" compress="true">/tmp/looltrace.gz</path>
|
||||
<filter>
|
||||
|
|
|
@ -261,6 +261,10 @@ void FileServerRequestHandler::preprocessFile(HTTPServerRequest& request, HTTPSe
|
|||
Poco::replaceInPlace(preprocess, std::string("%HOST%"), host);
|
||||
Poco::replaceInPlace(preprocess, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
|
||||
|
||||
const auto& config = Application::instance().config();
|
||||
const auto loleafletLogging = config.getString("loleaflet_logging", "false");
|
||||
Poco::replaceInPlace(preprocess, std::string("%LOLEAFLET_LOGGING%"), loleafletLogging);
|
||||
|
||||
response.setContentType("text/html");
|
||||
response.setContentLength(preprocess.length());
|
||||
response.setChunkedTransferEncoding(false);
|
||||
|
|
|
@ -1557,6 +1557,7 @@ void LOOLWSD::initialize(Application& self)
|
|||
{ "loleaflet_html", "loleaflet.html" },
|
||||
{ "logging.color", "true" },
|
||||
{ "logging.level", "trace" },
|
||||
{ "loleaflet_logging", "false" },
|
||||
{ "ssl.enable", "true" },
|
||||
{ "ssl.termination", "true" },
|
||||
{ "ssl.cert_file_path", LOOLWSD_CONFIGDIR "/cert.pem" },
|
||||
|
|
Loading…
Reference in New Issue