Commit Graph

140 Commits

Author SHA1 Message Date
Armin Novak
b260937ca6 Use __attribute__((destructor)) on non windows systems.
atexit in shared libraries is not universally supported.
2018-04-03 14:04:22 +02:00
Armin Novak
e1b53a282f Fix #4524: Initialize with cleanup handler
Use singleton initializer and register cleanup handler for logger.
2018-04-03 10:18:59 +02:00
Armin Novak
2d58e96dcc Exit main thread with winpr_exit to trigger resource cleanup.
When using pthread_once with destructors they are only called,
if each thread (including the main thread) is exited with pthread_exit.
Introducing winpr_exit as a wrapper for that purpose.
2018-02-12 10:33:02 +01:00
Bernhard Miklautz
52fbfb7b12 fix clang warnings, directly include wtypes.h (#4097)
* build: clang use -Wno-unused-command-line-argument

With clang 5.0 builds are quite noisy otherwise.

* Directly include wtypes.h

Directly include winpr/wtypes.h where _fseeki64 or _ftelli64 is used.

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: parentheses-equality

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: tautological-compare

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning:
incompatible pointer types passing 'size_t *' (aka 'unsigned
long *') to parameter of type 'UINT32 *' (aka 'unsigned int *')
[-Wincompatible-pointer-types]
2017-08-29 09:09:38 +02:00
Armin Novak
c3d4b7d262 fseeko and ftello for 64bit file support. 2017-08-14 08:42:49 +02:00
Armin Novak
09d43a66f4 Fixed tests and dead store warnings. 2017-03-28 16:49:56 +02:00
Armin Novak
3b56cd652f Fix format string is not a string literal 2017-03-14 10:56:00 +01:00
Armin Novak
b574e196d9 Fixed WLog_PrintMessagePrefixVA
WLog_PrintMessagePrefixVA is called with format being a stack variable.
Always copy the data to message->PrefixString otherwise the information
will be lost whenever the stack is destroyed.
2017-03-03 14:11:28 +01:00
Armin Novak
99c45405cb Fixed GetEnvironmentVariable. 2017-03-03 12:43:00 +01:00
Armin Novak
b2c29158be Scanbuild warning, argument checks and leak fixes.
* Added Stream_GetRemainingCapacity to check remaining stream size
  before writes.
* Fixed shadow server memory leak.
* Fixed lots of scanbuild warnings
* Added missing argument checks in many functions
* Added missing static function declarations
2017-03-02 18:13:43 +01:00
Armin Novak
e9b5d78673 Fixed scanbuild warnings. 2017-02-20 14:28:33 +01:00
Armin Novak
c249705085 Fixed scanbuild warnings. 2017-02-20 13:45:19 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Armin Novak
8a80a10bc3 Fixed format specifier mismatch. 2016-12-02 12:04:53 +01:00
Armin Novak
943e295714 WLog using C99 compatible variadic macros. 2016-10-07 14:05:27 +02:00
Armin Novak
d96fbd1bce Initialise WLog PrefixString for each message type. 2016-07-05 13:00:54 +02:00
Norbert Federa
e8c4910e2e fix segfaults casused by size_t format specifier
win32/msvc cc does not recognize the %z format specifier which caused
invalid references and segfaults on win32.
Until FreeRDP gets format specifier macros we'll cast size_t to
unsigned long and use the %lu specifier.

Also simplified winpr_backtrace_symbols() a little bit and fixed it
to allocate the correct amount of bytes for the return buffer.
2016-05-27 15:55:28 +02:00
Marc-André Moreau
915b9a15b1 Merge branch 'master' of github.com:FreeRDP/FreeRDP
Conflicts:
	winpr/libwinpr/bcrypt/CMakeLists.txt
2016-05-11 11:05:17 -04:00
Marc-André Moreau
9211f44e46 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-15 20:19:15 -04:00
Hardening
19494bd75a Make systemd appender honor layout and log off 2016-03-10 23:41:12 +01:00
Marc-André Moreau
ceefc4b099 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-07 10:19:50 -05:00
Armin Novak
ee2839fc7f Caching log filter after first use.
Reduce runtime penalty for log level checks by
remembering the log level found during first call.
2016-03-03 12:43:39 +01:00
Armin Novak
0ea7aea6d9 Remember filter log level. 2016-03-02 19:07:32 +01:00
Armin Novak
41fdac2667 Respecting filter in WLog_GetLogLevel 2016-03-02 14:11:15 +01:00
Armin Novak
1036f1e296 Fixed default visibility.
When nothing is declared, only export symbols defined
with WINPR_API or FREERDP_API defined.
Override this setting if BUILD_TESTING to allow tests
access to internal functions usually not exposed.
2016-02-26 19:44:14 +01:00
Marc-André Moreau
d0f413db12 winpr: initial port to Universal Windows Platform (UWP) 2016-02-05 16:28:45 -05:00
Martin Fleisz
56a0c4c336 Merge pull request #3097 from akallabeth/android_api_upgrade_v4
Android api upgrade and restructuring
2016-02-04 16:20:59 +01:00
Armin Novak
f835744a88 Removed unused variable. 2016-02-03 12:45:49 +01:00
Armin Novak
d1c59f7574 Fixed invalid boolean check. 2016-02-03 11:23:41 +01:00
Armin Novak
61633a1c66 Fixed android build issues. 2016-02-01 15:21:07 +01:00
Armin Novak
c2515340c3 Fixed return value of WLog_FileAppender_WriteImageMessage 2016-01-28 12:08:57 +01:00
Armin Novak
06adbc971a Fixed realloc check, renamed filter variable. 2016-01-27 11:21:04 +01:00
Armin Novak
46a079fcb6 Added new command line options for logger.
The new command line options /log-level:<level> and
/log-filters:<filter>:<level> allow setting default log
level and log module filter to be set.
2016-01-23 15:16:13 +01:00
Xiaodong Qi
602d2715a2 Fix compilation error under Visual Studio 2010
Visual Studio 2010 use a compiler that supports only C89, which
only supports declaring variable at top of a local scope. Moving
scope variable to the top of function should solve this problem.
2015-11-29 00:14:29 +08:00
Bernhard Miklautz
bff63b3ee2 wlog: cleanup API includes
Only include necessary header files.
2015-11-10 16:29:09 +01:00
Bernhard Miklautz
be0845b46c wlog/journald: don't set a default identifier
Don't set the identifier to "winpr" as default value because journald
will use the programs name as default if no identifier is set.
This way a program using WLog doesn't need to set an identifier (except
it want something different then it's name).
2015-11-10 13:40:52 +01:00
Bernhard Miklautz
34c707304b wlog: change variable naming and fix documentation
* change State to active and make it BOOL since it's only got two
  used values
* fix some typos in the documentation
2015-11-10 12:05:23 +01:00
Bernhard Miklautz
25137988fe wlog: fix build on windows 2015-11-09 19:47:51 +01:00
Bernhard Miklautz
57f952bbbc wlog: fix android build 2015-11-09 19:37:02 +01:00
Bernhard Miklautz
07417599ce wlog: rework, cleanup and stabilize API
* only expose necessary functions and types in header
* don't expose appender internals
* add generic function WLog_ConfigureAppender to have the possibility
  to configure appender specific settings
* detect appender availability if WLog_SetLogAppenderType or
  WLog_Appender_New return FALSE or NULL respectively the appender isn't
  available or the initialization failed. This is very useful for the
  use with optional appenders.
* add Free to the appender interface. At the time of the Free the
  appender is known and available so it can be called directly (instead
  of calling the right function according to the type)
* make all appender internal function static
* all appenders return the generic wLogAppender type now. Typecasts
  are internally done where necessary this abstracts the appenders more
  cleanly
2015-11-09 18:25:45 +01:00
David FORT
458aaa1213 Take in account @nfedera's remarks 2015-11-06 23:17:11 +01:00
David FORT
5fbf26acf2 Add an UDP appender to wLog
This appender allows to receive the logs over a network connection using UDP packets.
You can see the logs using a listening netcat, for example: nc -ul 127.0.0.1 20000.
2015-11-04 18:11:19 +01:00
David FORT
2a8de84342 Take in account @bmiklautz remarks
* I have added a function to set the journal identifier
* the appender name has been changed from SYSTEMD to JOURNALD
2015-11-01 21:34:03 +01:00
David FORT
e3915b66b7 Fix the env var leak 2015-10-30 20:22:25 +01:00
David FORT
89156e53b7 Use unbuffered output 2015-10-30 20:20:42 +01:00
David FORT
9ea301983d Adds a systemd journal appender 2015-10-30 14:50:14 +01:00
Bernhard Miklautz
a011719831 Merge pull request #2940 from hardening/syslog_appender
Add a wLog syslog appender
2015-10-29 18:44:14 +01:00
David FORT
8d2aadfccd Fixed a warning 2015-10-29 18:33:42 +01:00
David FORT
c2a322f4d0 Support syslog type for the WLOG_APPENDER env var 2015-10-29 18:31:22 +01:00
Martin Fleisz
08cbcb3577 wlog: Fix variable definitions 2015-10-23 12:08:20 +02:00