ObjFW  Diff

Differences From Artifact [4f22007bd2]:

To Artifact [470dd5a9cf]:


56
57
58
59
60
61
62






63
64
65
66




















67
68
69
70
71
72
73
74
75
76
77
78
79










80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifdef OF_WINDOWS
void
_reference_to_OFWin32ConsoleStdIOStream(void)
{
	[OFWin32ConsoleStdIOStream class];
}
#endif







OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;





















#ifdef OF_AMIGAOS
OF_DESTRUCTOR()
{
	[of_stdin dealloc];
	[of_stdout dealloc];
	[of_stderr dealloc];
}
#endif

void
of_log(OFConstantString *format, ...)
{










	void *pool = objc_autoreleasePoolPush();
	OFDate *date;
	OFString *dateString, *me, *msg;
	va_list arguments;

	date = [OFDate date];
	dateString = [date localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"];
#ifdef OF_HAVE_FILES
	me = [OFApplication programName].lastPathComponent;
#else
	me = [OFApplication programName];
#endif

	va_start(arguments, format);
	msg = [[[OFString alloc] initWithFormat: format
				      arguments: arguments] autorelease];
	va_end(arguments);

	[of_stderr writeFormat: @"[%@.%03d %@(%d)] %@\n", dateString,
				date.microsecond / 1000, me, getpid(), msg];

	objc_autoreleasePoolPop(pool);
}








>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













>
>
>
>
>
>
>
>
>
>



<









<


<







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
134
135
136
#ifdef OF_WINDOWS
void
_reference_to_OFWin32ConsoleStdIOStream(void)
{
	[OFWin32ConsoleStdIOStream class];
}
#endif

#ifdef OF_AMIGAOS
# undef of_stdin
# undef of_stdout
# undef of_stderr
#endif

OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;

#ifdef OF_AMIGAOS
OFStdIOStream **
of_stdin_ref(void)
{
	return &of_stdin;
}

OFStdIOStream **
of_stdout_ref(void)
{
	return &of_stdout;
}

OFStdIOStream **
of_stderr_ref(void)
{
	return &of_stderr;
}
#endif

#ifdef OF_AMIGAOS
OF_DESTRUCTOR()
{
	[of_stdin dealloc];
	[of_stdout dealloc];
	[of_stderr dealloc];
}
#endif

void
of_log(OFConstantString *format, ...)
{
	va_list arguments;

	va_start(arguments, format);
	of_logv(format, arguments);
	va_end(arguments);
}

void
of_logv(OFConstantString *format, va_list arguments)
{
	void *pool = objc_autoreleasePoolPush();
	OFDate *date;
	OFString *dateString, *me, *msg;


	date = [OFDate date];
	dateString = [date localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"];
#ifdef OF_HAVE_FILES
	me = [OFApplication programName].lastPathComponent;
#else
	me = [OFApplication programName];
#endif


	msg = [[[OFString alloc] initWithFormat: format
				      arguments: arguments] autorelease];


	[of_stderr writeFormat: @"[%@.%03d %@(%d)] %@\n", dateString,
				date.microsecond / 1000, me, getpid(), msg];

	objc_autoreleasePoolPop(pool);
}