Changeset e47e1b0 for logging.c


Ignore:
Timestamp:
Aug 5, 2017, 11:21:53 PM (7 years ago)
Author:
Jason Gross <jasongross9@gmail.com>
Branches:
master
Children:
ec36247
Parents:
8eb72d2
git-author:
Jason Gross <jgross@mit.edu> (05/26/13 12:40:04)
git-committer:
Jason Gross <jasongross9@gmail.com> (08/05/17 23:21:53)
Message:
Display log file name on failure to open file

Also, make owl_log_error be like printf.  This will be more useful in
the next commit, when we display error codes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    r7dcef03 re47e1b0  
    151151}
    152152
    153 static void owl_log_error(const char *message)
    154 {
    155   char *data = g_strdup(message);
     153static void G_GNUC_PRINTF(1, 2) owl_log_error(const char *fmt, ...)
     154{
     155  va_list ap;
     156  char *data;
     157
     158  va_start(ap, fmt);
     159  data = g_strdup_vprintf(fmt, ap);
     160  va_end(ap);
     161
    156162  owl_select_post_task(owl_log_error_main_thread,
    157                        data, g_free, g_main_context_default());
     163                       data, g_free, g_main_context_default());
    158164}
    159165
     
    164170  file = fopen(msg->filename, "a");
    165171  if (!file) {
    166     owl_log_error("Unable to open file for logging");
     172    owl_log_error("Unable to open file for logging (%s)", msg->filename);
    167173    return;
    168174  }
Note: See TracChangeset for help on using the changeset viewer.