Commit af87144183d86535b528d5dfb39a5dda8f411cf8

Authored by Perry Werneck
1 parent 243acfe8

Fixing null module on log manager.

Showing 1 changed file with 7 additions and 11 deletions   Show diff stats
src/core/log.c
... ... @@ -49,31 +49,27 @@
49 49  
50 50 /*---[ Implementacao ]--------------------------------------------------------------------------------------*/
51 51  
52   - LIB3270_EXPORT void lib3270_set_log_handler(void (*handler)(H3270 *, const char *, int, const char *, va_list))
53   - {
  52 + LIB3270_EXPORT void lib3270_set_log_handler(void (*handler)(H3270 *, const char *, int, const char *, va_list)) {
54 53 loghandler = handler ? handler : default_log_writer;
55 54 }
56 55  
57   - LIB3270_EXPORT int lib3270_write_log(H3270 *session, const char *module, const char *fmt, ...)
58   - {
  56 + LIB3270_EXPORT int lib3270_write_log(H3270 *session, const char *module, const char *fmt, ...) {
59 57 va_list arg_ptr;
60 58 va_start(arg_ptr, fmt);
61   - loghandler(session,module,0,fmt,arg_ptr);
  59 + loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg_ptr);
62 60 va_end(arg_ptr);
63 61 return 0;
64 62 }
65 63  
66   - LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...)
67   - {
  64 + LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...) {
68 65 va_list arg_ptr;
69 66 va_start(arg_ptr, fmt);
70   - loghandler(session,module,rc,fmt,arg_ptr);
  67 + loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),rc,fmt,arg_ptr);
71 68 va_end(arg_ptr);
72 69 return rc;
73 70 }
74 71  
75   - LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg)
76   - {
77   - loghandler(session,module,0,fmt,arg);
  72 + LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg) {
  73 + loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg);
78 74 }
79 75  
... ...