Skip to content
metalefty edited this page Jul 27, 2017 · 8 revisions

Goal

Eliminate all logs written to stdout/stdout. All logs should be written to log files. Don't have user to run xrdp/xrdp-sesman in foreground to investigate issues.

Current logging functions/macros (terribly confusing)

  • g_writeln()
  • log_message()
  • LLOGLN() macro uses g_writeln()
  • LLOG() macro uses g_write()
  • DEBUG() macro uses g_writeln() (debug build only)
  • LOG_DBG() macro uses log_message(LOG_LEVEL_DEBUG, ) (debug build only)

and more.

New logging functions

Almost all logs should be logged via log_message() as far as possible.

Log level TRACE is newly introduced log level which means more verbose then DEBUG.

Aliases (macro)

  • log_always(args..) -> log_message(LOG_LEVEL_ALWAYS, args)
  • log_error(args..) -> log_message(LOG_LEVEL_ERROR, args)
  • log_warning(args..) -> log_message(LOG_LEVEL_WARNING, args)
  • log_info(args..) -> log_message(LOG_LEVEL_INFO, args)
  • log_debug(args..) -> log_message(LOG_LEVEL_DEBUG, args)
  • log_trace(args..) -> log_message(LOG_LEVEL_TRACE, args)
  • log_trace_verbose(args..) -> log_message(LOG_LEVEL_TRACE, args) (debug build only)
#define log_always(args..)  log_message(LOG_LEVEL_ALWAYS, args);
#define log_error(args..)   log_message(LOG_LEVEL_ERROR, args);
#define log_warning(args..) log_message(LOG_LEVEL_WARNING, args);
#define log_info(args..)    log_message(LOG_LEVEL_INFO, args);
#define log_debug(args..)   log_message(LOG_LEVEL_DEBUG, args);
#define log_trace(args..)   log_message(LOG_LEVEL_TRACE, args);
#if defined(XRDP_DEBUG)
#define log_trace_verbose(args..) log_message(LOG_LEVEL_TRACE, args);
#else
#define log_trace_verbose(args..)
#endif

Usage of g_write(), g_writeln()

Limited to using really need to write stdout. Ex. output of xrdp -h.

Converting

  • g_writeln() -> log_trace()
  • LOG_DBG() -> log_trace_verbose()
Clone this wiki locally