Changeset 9bfab40
- Timestamp:
- Aug 16, 2017, 12:53:41 PM (7 years ago)
- Branches:
- master
- Children:
- 5093c6f
- Parents:
- ff528e6
- git-author:
- Jason Gross <jgross@mit.edu> (07/12/11 15:23:27)
- git-committer:
- Jason Gross <jasongross9@gmail.com> (08/16/17 12:53:41)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
logging.c
reea7bed4 r9bfab40 310 310 void owl_log_outgoing_zephyr_error(const owl_zwrite *zw, const char *text) 311 311 { 312 char *filename, *logpath;313 char *tobuff, *recip;314 312 owl_message *m; 315 GString *msgbuf;316 313 /* create a present message so we can pass it to 317 314 * owl_log_shouldlog_message(void) … … 324 321 return; 325 322 } 323 char *buffer = owl_perlconfig_message_call_method(m, "log_outgoing_error", 0, NULL); 324 char *filenames_string = owl_perlconfig_call_with_message("BarnOwl::Logging::get_filenames_as_string", m); 325 char **filenames = g_strsplit(filenames_string, " ", 0); 326 char **filename_ptr; 327 328 for (filename_ptr = filenames; *filename_ptr != NULL; filename_ptr++) { 329 owl_log_enqueue_message(buffer, *filename_ptr); 330 } 331 332 g_free(filenames_string); 333 g_strfreev(filenames); 326 334 owl_message_delete(m); 327 328 /* chop off a local realm */329 recip = owl_zwrite_get_recip_n_with_realm(zw, 0);330 tobuff = short_zuser(recip);331 g_free(recip);332 333 /* expand ~ in path names */334 logpath = owl_util_makepath(owl_global_get_logpath(&g));335 filename = g_build_filename(logpath, tobuff, NULL);336 msgbuf = g_string_new("");337 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text);338 if (text[strlen(text)-1] != '\n') {339 g_string_append_printf(msgbuf, "\n");340 }341 owl_log_enqueue_message(msgbuf->str, filename);342 g_string_free(msgbuf, TRUE);343 344 filename = g_build_filename(logpath, "all", NULL);345 g_free(logpath);346 msgbuf = g_string_new("");347 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text);348 if (text[strlen(text)-1] != '\n') {349 g_string_append_printf(msgbuf, "\n");350 }351 owl_log_enqueue_message(msgbuf->str, filename);352 g_string_free(msgbuf, TRUE);353 354 g_free(tobuff);355 335 } 356 336 -
perl/lib/BarnOwl/Message.pm
reea7bed4 r9bfab40 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.