FreeRDP
include/winpr/wlog.h File Reference
#include <stdarg.h>
#include <winpr/wtypes.h>
#include <winpr/winpr.h>
#include <winpr/synch.h>
#include <winpr/thread.h>

Data Structures

struct  wLogMessage
 
struct  wLogCallbacks
 

Macros

#define WLOG_TRACE   0
 
#define WLOG_DEBUG   1
 
#define WLOG_INFO   2
 
#define WLOG_WARN   3
 
#define WLOG_ERROR   4
 
#define WLOG_FATAL   5
 
#define WLOG_OFF   6
 
#define WLOG_LEVEL_INHERIT   0xFFFF
 
#define WLOG_MESSAGE_TEXT   0
 
#define WLOG_MESSAGE_DATA   1
 
#define WLOG_MESSAGE_IMAGE   2
 
#define WLOG_MESSAGE_PACKET   3
 
#define WLOG_APPENDER_CONSOLE   0
 
#define WLOG_APPENDER_FILE   1
 
#define WLOG_APPENDER_BINARY   2
 
#define WLOG_APPENDER_CALLBACK   3
 
#define WLOG_APPENDER_SYSLOG   4
 
#define WLOG_APPENDER_JOURNALD   5
 
#define WLOG_APPENDER_UDP   6
 
#define WLOG_PACKET_INBOUND   1
 
#define WLOG_PACKET_OUTBOUND   2
 
#define WLog_Print_unchecked(_log, _log_level, ...)
 
#define WLog_Print(_log, _log_level, ...)
 
#define WLog_Print_tag(_tag, _log_level, ...)
 
#define WLog_PrintVA_unchecked(_log, _log_level, _args)
 
#define WLog_PrintVA(_log, _log_level, _args)
 
#define WLog_Data(_log, _log_level, ...)
 
#define WLog_Image(_log, _log_level, ...)
 
#define WLog_Packet(_log, _log_level, ...)
 
#define WLog_LVL(tag, lvl, ...)   WLog_Print_tag(tag, lvl, __VA_ARGS__)
 
#define WLog_VRB(tag, ...)   WLog_Print_tag(tag, WLOG_TRACE, __VA_ARGS__)
 
#define WLog_DBG(tag, ...)   WLog_Print_tag(tag, WLOG_DEBUG, __VA_ARGS__)
 
#define WLog_INFO(tag, ...)   WLog_Print_tag(tag, WLOG_INFO, __VA_ARGS__)
 
#define WLog_WARN(tag, ...)   WLog_Print_tag(tag, WLOG_WARN, __VA_ARGS__)
 
#define WLog_ERR(tag, ...)   WLog_Print_tag(tag, WLOG_ERROR, __VA_ARGS__)
 
#define WLog_FATAL(tag, ...)   WLog_Print_tag(tag, WLOG_FATAL, __VA_ARGS__)
 

Typedefs

typedef BOOL(* wLogCallbackMessage_t) (const wLogMessage *msg)
 
typedef BOOL(* wLogCallbackData_t) (const wLogMessage *msg)
 
typedef BOOL(* wLogCallbackImage_t) (const wLogMessage *msg)
 
typedef BOOL(* wLogCallbackPackage_t) (const wLogMessage *msg)
 

Functions

WINPR_API BOOL WLog_PrintMessage (wLog *log, DWORD type, DWORD level, size_t line, const char *file, const char *function,...)
 
WINPR_API BOOL WLog_PrintMessageVA (wLog *log, DWORD type, DWORD level, size_t line, const char *file, const char *function, va_list args)
 
WINPR_API wLog * WLog_GetRoot (void)
 
WINPR_API wLog * WLog_Get (LPCSTR name)
 
WINPR_API DWORD WLog_GetLogLevel (wLog *log)
 
WINPR_API BOOL WLog_IsLevelActive (wLog *_log, DWORD _log_level)
 
WINPR_API BOOL WLog_SetContext (wLog *log, const char *(*fkt)(void *), void *context)
 Set a custom context for a dynamic logger. This can be used to print a customized prefix, e.g. some session id for a specific context. More...
 
WINPR_API BOOL WLog_SetLogLevel (wLog *log, DWORD logLevel)
 
WINPR_API BOOL WLog_SetStringLogLevel (wLog *log, LPCSTR level)
 
WINPR_API BOOL WLog_AddStringLogFilters (LPCSTR filter)
 
WINPR_API BOOL WLog_SetLogAppenderType (wLog *log, DWORD logAppenderType)
 
WINPR_API wLogAppender * WLog_GetLogAppender (wLog *log)
 
WINPR_API BOOL WLog_OpenAppender (wLog *log)
 
WINPR_API BOOL WLog_CloseAppender (wLog *log)
 
WINPR_API BOOL WLog_ConfigureAppender (wLogAppender *appender, const char *setting, void *value)
 
WINPR_API wLogLayout * WLog_GetLogLayout (wLog *log)
 
WINPR_API BOOL WLog_Layout_SetPrefixFormat (wLog *log, wLogLayout *layout, const char *format)
 

Macro Definition Documentation

◆ WLOG_APPENDER_BINARY

#define WLOG_APPENDER_BINARY   2

◆ WLOG_APPENDER_CALLBACK

#define WLOG_APPENDER_CALLBACK   3

◆ WLOG_APPENDER_CONSOLE

#define WLOG_APPENDER_CONSOLE   0

Log Appenders

◆ WLOG_APPENDER_FILE

#define WLOG_APPENDER_FILE   1

◆ WLOG_APPENDER_JOURNALD

#define WLOG_APPENDER_JOURNALD   5

◆ WLOG_APPENDER_SYSLOG

#define WLOG_APPENDER_SYSLOG   4

◆ WLOG_APPENDER_UDP

#define WLOG_APPENDER_UDP   6

◆ WLog_Data

#define WLog_Data (   _log,
  _log_level,
  ... 
)
Value:
do \
{ \
if (WLog_IsLevelActive(_log, _log_level)) \
{ \
WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \
__VA_ARGS__); \
} \
} while (0)
WINPR_API BOOL WLog_IsLevelActive(wLog *_log, DWORD _log_level)
Definition: wlog.c:441
#define WLOG_MESSAGE_DATA
Definition: include/winpr/wlog.h:53

◆ WLog_DBG

#define WLog_DBG (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_DEBUG, __VA_ARGS__)

◆ WLOG_DEBUG

#define WLOG_DEBUG   1

◆ WLog_ERR

#define WLog_ERR (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_ERROR, __VA_ARGS__)

◆ WLOG_ERROR

#define WLOG_ERROR   4

◆ WLOG_FATAL

#define WLOG_FATAL   5

◆ WLog_FATAL

#define WLog_FATAL (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_FATAL, __VA_ARGS__)

◆ WLog_Image

#define WLog_Image (   _log,
  _log_level,
  ... 
)
Value:
do \
{ \
if (WLog_IsLevelActive(_log, _log_level)) \
{ \
WLog_PrintMessage(_log, WLOG_MESSAGE_DATA, _log_level, __LINE__, __FILE__, __func__, \
__VA_ARGS__); \
} \
} while (0)

◆ WLOG_INFO

#define WLOG_INFO   2

◆ WLog_INFO

#define WLog_INFO (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_INFO, __VA_ARGS__)

◆ WLOG_LEVEL_INHERIT

#define WLOG_LEVEL_INHERIT   0xFFFF

◆ WLog_LVL

#define WLog_LVL (   tag,
  lvl,
  ... 
)    WLog_Print_tag(tag, lvl, __VA_ARGS__)

◆ WLOG_MESSAGE_DATA

#define WLOG_MESSAGE_DATA   1

◆ WLOG_MESSAGE_IMAGE

#define WLOG_MESSAGE_IMAGE   2

◆ WLOG_MESSAGE_PACKET

#define WLOG_MESSAGE_PACKET   3

◆ WLOG_MESSAGE_TEXT

#define WLOG_MESSAGE_TEXT   0

Log Message

◆ WLOG_OFF

#define WLOG_OFF   6

◆ WLog_Packet

#define WLog_Packet (   _log,
  _log_level,
  ... 
)
Value:
do \
{ \
if (WLog_IsLevelActive(_log, _log_level)) \
{ \
WLog_PrintMessage(_log, WLOG_MESSAGE_PACKET, _log_level, __LINE__, __FILE__, __func__, \
__VA_ARGS__); \
} \
} while (0)
#define WLOG_MESSAGE_PACKET
Definition: include/winpr/wlog.h:55

◆ WLOG_PACKET_INBOUND

#define WLOG_PACKET_INBOUND   1

◆ WLOG_PACKET_OUTBOUND

#define WLOG_PACKET_OUTBOUND   2

◆ WLog_Print

#define WLog_Print (   _log,
  _log_level,
  ... 
)
Value:
do \
{ \
if (WLog_IsLevelActive(_log, _log_level)) \
{ \
WLog_Print_unchecked(_log, _log_level, ##__VA_ARGS__); \
} \
} while (0)

◆ WLog_Print_tag

#define WLog_Print_tag (   _tag,
  _log_level,
  ... 
)
Value:
do \
{ \
static wLog* _log_cached_ptr = NULL; \
if (!_log_cached_ptr) \
_log_cached_ptr = WLog_Get(_tag); \
WLog_Print(_log_cached_ptr, _log_level, __VA_ARGS__); \
} while (0)
if availableBytes return NULL
Definition: TPCircularBuffer.h:109
WINPR_API wLog * WLog_Get(LPCSTR name)
Definition: wlog.c:1028

◆ WLog_Print_unchecked

#define WLog_Print_unchecked (   _log,
  _log_level,
  ... 
)
Value:
do \
{ \
WLog_PrintMessage(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \
__VA_ARGS__); \
} while (0)
#define WLOG_MESSAGE_TEXT
Definition: include/winpr/wlog.h:52

◆ WLog_PrintVA

#define WLog_PrintVA (   _log,
  _log_level,
  _args 
)
Value:
do \
{ \
if (WLog_IsLevelActive(_log, _log_level)) \
{ \
WLog_PrintVA_unchecked(_log, _log_level, _args); \
} \
} while (0)

◆ WLog_PrintVA_unchecked

#define WLog_PrintVA_unchecked (   _log,
  _log_level,
  _args 
)
Value:
do \
{ \
WLog_PrintMessageVA(_log, WLOG_MESSAGE_TEXT, _log_level, __LINE__, __FILE__, __func__, \
_args); \
} while (0)

◆ WLOG_TRACE

#define WLOG_TRACE   0

WinPR: Windows Portable Runtime WinPR Logger

Copyright 2013 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015 Thincast Technologies GmbH Copyright 2015 Bernhard Miklautz bernh.nosp@m.ard..nosp@m.mikla.nosp@m.utz@.nosp@m.thinc.nosp@m.ast..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Log Levels

◆ WLog_VRB

#define WLog_VRB (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_TRACE, __VA_ARGS__)

◆ WLOG_WARN

#define WLOG_WARN   3

◆ WLog_WARN

#define WLog_WARN (   tag,
  ... 
)    WLog_Print_tag(tag, WLOG_WARN, __VA_ARGS__)

Typedef Documentation

◆ wLogCallbackData_t

typedef BOOL(* wLogCallbackData_t) (const wLogMessage *msg)

◆ wLogCallbackImage_t

typedef BOOL(* wLogCallbackImage_t) (const wLogMessage *msg)

◆ wLogCallbackMessage_t

typedef BOOL(* wLogCallbackMessage_t) (const wLogMessage *msg)

◆ wLogCallbackPackage_t

typedef BOOL(* wLogCallbackPackage_t) (const wLogMessage *msg)

Function Documentation

◆ WLog_AddStringLogFilters()

WINPR_API BOOL WLog_AddStringLogFilters ( LPCSTR  filter)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_CloseAppender()

WINPR_API BOOL WLog_CloseAppender ( wLog *  log)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_ConfigureAppender()

WINPR_API BOOL WLog_ConfigureAppender ( wLogAppender *  appender,
const char *  setting,
void *  value 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_Get()

WINPR_API wLog* WLog_Get ( LPCSTR  name)
Here is the call graph for this function:

◆ WLog_GetLogAppender()

WINPR_API wLogAppender* WLog_GetLogAppender ( wLog *  log)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_GetLogLayout()

WINPR_API wLogLayout* WLog_GetLogLayout ( wLog *  log)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_GetLogLevel()

WINPR_API DWORD WLog_GetLogLevel ( wLog *  log)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_GetRoot()

WINPR_API wLog* WLog_GetRoot ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_IsLevelActive()

WINPR_API BOOL WLog_IsLevelActive ( wLog *  _log,
DWORD  _log_level 
)
Here is the call graph for this function:

◆ WLog_Layout_SetPrefixFormat()

WINPR_API BOOL WLog_Layout_SetPrefixFormat ( wLog *  log,
wLogLayout *  layout,
const char *  format 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_OpenAppender()

WINPR_API BOOL WLog_OpenAppender ( wLog *  log)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_PrintMessage()

WINPR_API BOOL WLog_PrintMessage ( wLog *  log,
DWORD  type,
DWORD  level,
size_t  line,
const char *  file,
const char *  function,
  ... 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_PrintMessageVA()

WINPR_API BOOL WLog_PrintMessageVA ( wLog *  log,
DWORD  type,
DWORD  level,
size_t  line,
const char *  file,
const char *  function,
va_list  args 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_SetContext()

WINPR_API BOOL WLog_SetContext ( wLog *  log,
const char *(*)(void *)  fkt,
void *  context 
)

Set a custom context for a dynamic logger. This can be used to print a customized prefix, e.g. some session id for a specific context.

Parameters
logThe logger to ste the context for. Must not be NULL
fktA function pointer that is called to get the custimized string.
contextA context fkt is called with. Caller must ensure it is still allocated when log is used
Returns
TRUE for success, FALSE otherwise.
Here is the caller graph for this function:

◆ WLog_SetLogAppenderType()

WINPR_API BOOL WLog_SetLogAppenderType ( wLog *  log,
DWORD  logAppenderType 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_SetLogLevel()

WINPR_API BOOL WLog_SetLogLevel ( wLog *  log,
DWORD  logLevel 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WLog_SetStringLogLevel()

WINPR_API BOOL WLog_SetStringLogLevel ( wLog *  log,
LPCSTR  level 
)
Here is the call graph for this function:
Here is the caller graph for this function: