diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-22 22:57:02 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-23 06:20:32 +0100 |
commit | 9a1610f8290f723e801864f9037d4467efd02d1a (patch) | |
tree | 476eeba143c70b6dd9e243e3ac27f61ab8b7dbb9 /extensions/source/logging/consolehandler.cxx | |
parent | ab0942240507e9be81dbe43e8d69b7f9273b124f (diff) |
Revert "unopkg: Correctly display log messages on Windows"
https://gerrit.libreoffice.org/c/core/+/87210 makes unopkg proper
console application, which doesn't need old complexity of sending
UTF-16 strings to console redirected to pipes, so this workaround
is not needed anymore.
This reverts commit 015e9f780bc133788f79868bb7fb0b1d4e81f5f3.
Change-Id: I9ab49df2b9c9cb841e591c07fcea191119dbe382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87217
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions/source/logging/consolehandler.cxx')
-rw-r--r-- | extensions/source/logging/consolehandler.cxx | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/extensions/source/logging/consolehandler.cxx b/extensions/source/logging/consolehandler.cxx index d213f5aab002..d1455baa3178 100644 --- a/extensions/source/logging/consolehandler.cxx +++ b/extensions/source/logging/consolehandler.cxx @@ -31,15 +31,9 @@ #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/supportsservice.hxx> -#include <osl/thread.hxx> #include <stdio.h> -#ifdef _WIN32 -#include <prewin.h> -#include <postwin.h> -#endif - namespace logging { using ::com::sun::star::logging::XConsoleHandler; @@ -221,38 +215,10 @@ namespace logging void SAL_CALL ConsoleHandler::flush( ) { MethodGuard aGuard( *this ); -#ifndef _WIN32 fflush( stdout ); fflush( stderr ); -#endif - } - - namespace - { - void lcl_printConsole(const OString& sText) - { -#ifdef _WIN32 - DWORD nWrittenChars = 0; - OUString s = OStringToOUString(sText, RTL_TEXTENCODING_ASCII_US); - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), s.getStr(), s.getLength() * 2, - &nWrittenChars, nullptr); -#else - fprintf(stdout, "%s\n", sText.getStr()); -#endif } - void lcl_printConsoleError(const OString& sText) - { -#ifdef _WIN32 - DWORD nWrittenChars = 0; - OUString s = OStringToOUString(sText, RTL_TEXTENCODING_ASCII_US); - WriteFile(GetStdHandle(STD_ERROR_HANDLE), s.getStr(), s.getLength() * 2, - &nWrittenChars, nullptr); -#else - fprintf(stderr, "%s\n", sText.getStr()); -#endif - } - } // namespace sal_Bool SAL_CALL ConsoleHandler::publish( const LogRecord& _rRecord ) { @@ -263,9 +229,10 @@ namespace logging return false; if ( _rRecord.Level >= m_nThreshold ) - lcl_printConsoleError(sEntry); + fprintf( stderr, "%s\n", sEntry.getStr() ); else - lcl_printConsole(sEntry); + fprintf( stdout, "%s\n", sEntry.getStr() ); + return true; } |