From: <ro...@us...> - 2006-07-04 22:13:07
|
Revision: 16422 Author: roast Date: 2006-07-04 15:12:58 -0700 (Tue, 04 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16422&view=rev Log Message: ----------- xml_logger's giochannel calls now nicely report errors Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-04 18:49:13 UTC (rev 16421) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-04 22:12:58 UTC (rev 16422) @@ -1046,6 +1046,12 @@ log->type == GAIM_LOG_SYSTEM ? "gaim:logtype=\"system\"" : "", date); iostat = g_io_channel_write_chars(data->channel, writebuf, -1, &written_buf, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_write could not write to new file: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } + written += written_buf; } @@ -1103,6 +1109,11 @@ } iostat = g_io_channel_write_chars(data->channel, writebuf, -1, &written_buf, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_write could not the message to the logfile: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } written += written_buf; g_free(date); @@ -1115,11 +1126,25 @@ gaim_utf8_strftime("%Y-%m-%d %H:%M:%S%z", NULL)); iostat = g_io_channel_write_chars(data->channel, writebuf, -1, &written_buf, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_write could not write the tail to the logfile: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } + iostat = g_io_channel_seek_position(data->channel, -1*(gint64)(written_buf), G_SEEK_CUR, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_write could not seek backwards to the beginning of the tail: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } - //gaim_debug_error("log", "Could not return logfile stream position after tail write."); - iostat = g_io_channel_flush(data->channel, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_write could not flush the logfile: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } return written; } @@ -1139,8 +1164,20 @@ gaim_utf8_strftime("%Y-%m-%d %H:%M:%S%z", NULL)); iostat = g_io_channel_write_chars(data->channel, writebuf, -1, NULL, &gerror); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_finalize could not write the tail: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } iostat = g_io_channel_shutdown(data->channel, TRUE, &gerror); // this may cause hanging + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log", "xml_logger_finalize could not shutdown the logfile: %s\n", gerror->message); + g_error_free(gerror); + gerror = NULL; + } + + } g_free(data->path); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |