Differences From Artifact [00f92e27f7]:
- File
src/OFFile.m
— part of check-in
[17338ef1d5]
at
2011-02-01 14:27:31
on branch trunk
— Add of_log for easy logging to stderr.
Uses OFConstantString* for the format to prevent users from doing stupid
things like of_log([of_stdin readLine]). (user: js, size: 15273) [annotate] [blame] [check-ins using]
To Artifact [719e5e7862]:
- File src/OFFile.m — part of check-in [f3bfba9d06] at 2011-02-01 22:18:18 on branch trunk — Show milliseconds in of_log output. (user: js, size: 15350) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
105 106 107 108 109 110 111 | return -1; } void of_log(OFConstantString *fmt, ...) { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; | > | > | | > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | return -1; } void of_log(OFConstantString *fmt, ...) { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDate *date; OFString *date_str, *me, *msg; va_list args; date = [OFDate date]; date_str = [date localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"]; me = [OFFile lastComponentOfPath: [OFApplication programName]]; va_start(args, fmt); msg = [[[OFString alloc] initWithFormat: fmt arguments: args] autorelease]; va_end(args); [of_stderr writeFormat: @"[%@.%03d %@(%d)] %@\n", date_str, [date microsecond] / 1000, me, getpid(), msg]; [pool release]; } @interface OFFileSingleton: OFFile @end |
︙ | ︙ |