Changeset f511c1e
- Timestamp:
- Jan 7, 2014, 6:00:47 PM (9 years ago)
- Children:
- 6e764aa
- Parents:
- e38cc20
- git-author:
- Jason Gross <jgross@mit.edu> (07/12/11 15:23:27)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/07/14 18:00:47)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
logging.c
rdca6255 rf511c1e 128 128 void owl_log_outgoing_zephyr_error(const owl_zwrite *zw, const char *text) 129 129 { 130 char *filename, *logpath;131 char *tobuff, *recip;132 130 owl_message *m; 133 GString *msgbuf;134 131 /* create a present message so we can pass it to 135 132 * owl_log_shouldlog_message(void) … … 142 139 return; 143 140 } 141 char *buffer = owl_perlconfig_message_call_method(m, "log_outgoing_error", 0, NULL); 142 char *filenames_string = owl_perlconfig_call_with_message("BarnOwl::Logging::get_filenames_as_string", m); 143 char **filenames = g_strsplit(filenames_string, " ", 0); 144 char **filename_ptr; 145 146 for (filename_ptr = filenames; *filename_ptr != NULL; filename_ptr++) { 147 owl_log_enqueue_message(buffer, *filename_ptr); 148 } 149 150 g_free(filenames_string); 151 g_strfreev(filenames); 144 152 owl_message_delete(m); 145 146 /* chop off a local realm */147 recip = owl_zwrite_get_recip_n_with_realm(zw, 0);148 tobuff = short_zuser(recip);149 g_free(recip);150 151 /* expand ~ in path names */152 logpath = owl_util_makepath(owl_global_get_logpath(&g));153 filename = g_build_filename(logpath, tobuff, NULL);154 msgbuf = g_string_new("");155 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text);156 if (text[strlen(text)-1] != '\n') {157 g_string_append_printf(msgbuf, "\n");158 }159 owl_log_enqueue_message(msgbuf->str, filename);160 g_string_free(msgbuf, TRUE);161 162 filename = g_build_filename(logpath, "all", NULL);163 g_free(logpath);164 msgbuf = g_string_new("");165 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text);166 if (text[strlen(text)-1] != '\n') {167 g_string_append_printf(msgbuf, "\n");168 }169 owl_log_enqueue_message(msgbuf->str, filename);170 g_string_free(msgbuf, TRUE);171 172 g_free(tobuff);173 153 } 174 154 -
perl/lib/BarnOwl/Message.pm
rdca6255 rf511c1e 210 210 sub log_base_path { 211 211 return BarnOwl::getvar('logpath'); 212 } 213 214 =head2 log_outgoing_error MESSAGE 215 216 Returns the string that should be logged if there is an error sending 217 an outgoing message. 218 219 =cut 220 221 sub log_outgoing_error { 222 my ($m) = @_; 223 my $recipient = $m->pretty_recipient; 224 my $body = $m->body; 225 chomp $body; 226 return "ERROR (BarnOwl): $recipient\n$body\n\n"; 212 227 } 213 228
Note: See TracChangeset
for help on using the changeset viewer.