@@ -119,18 +119,26 @@ extern void BNCLogSetFlushFunction(BNCLogFlushFunctionPtr _Nullable flushFunctio
119119extern BNCLogFlushFunctionPtr _Nullable BNCLogFlushFunction ();
120120
121121
122- #pragma mark - BNCLogMessageInternal
122+ #pragma mark - BNCLogWriteMessage
123123
124124
125- // / The main logging function used in the logging defines.
126- extern void BNCLogMessageInternal (
125+ // / The main logging function used in the variadic logging defines.
126+ extern void BNCLogWriteMessageFormat (
127127 BNCLogLevel logLevel,
128128 const char *_Nullable sourceFileName,
129129 int sourceLineNumber,
130130 id _Nullable messageFormat,
131131 ...
132132);
133133
134+ // / Swift-friendly wrapper for BNCLogWriteMessageFormat
135+ extern void BNCLogWriteMessage (
136+ BNCLogLevel logLevel,
137+ NSString *_Nonnull sourceFileName,
138+ NSUInteger sourceLineNumber,
139+ NSString *_Nonnull message
140+ );
141+
134142// / This function synchronizes all outstanding log messages and writes them to the logging function
135143// / set by BNCLogSetOutputFunction.
136144extern void BNCLogFlushMessages ();
@@ -141,25 +149,25 @@ extern void BNCLogFlushMessages();
141149
142150// /@param format Log a debug message with the specified formatting.
143151#define BNCLogDebug (...) \
144- do { BNCLogMessageInternal (BNCLogLevelDebug, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
152+ do { BNCLogWriteMessageFormat (BNCLogLevelDebug, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
145153
146154// /@param format Log a warning message with the specified formatting.
147155#define BNCLogWarning (...) \
148- do { BNCLogMessageInternal (BNCLogLevelWarning, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
156+ do { BNCLogWriteMessageFormat (BNCLogLevelWarning, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
149157
150158// /@param format Log an error message with the specified formatting.
151159#define BNCLogError (...) \
152- do { BNCLogMessageInternal (BNCLogLevelError, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
160+ do { BNCLogWriteMessageFormat (BNCLogLevelError, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
153161
154162// /@param format Log a message with the specified formatting.
155163#define BNCLog (...) \
156- do { BNCLogMessageInternal (BNCLogLevelLog, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
164+ do { BNCLogWriteMessageFormat (BNCLogLevelLog, __FILE__, __LINE__, __VA_ARGS__); } while (0 )
157165
158166// /Cause a programmatic breakpoint if breakpoints are enabled.
159167#define BNCLogBreakPoint () \
160168 do { \
161169 if (BNCLogBreakPointsAreEnabled ()) { \
162- BNCLogMessageInternal (BNCLogLevelBreakPoint, __FILE__, __LINE__, @" Programmatic breakpoint." ); \
170+ BNCLogWriteMessageFormat (BNCLogLevelBreakPoint, __FILE__, __LINE__, @" Programmatic breakpoint." ); \
163171 if (BNCDebuggerIsAttached ()) { \
164172 BNCLogFlushMessages (); \
165173 BNCDebugBreakpoint (); \
@@ -171,7 +179,7 @@ extern void BNCLogFlushMessages();
171179#define BNCBreakPointWithMessage (...) \
172180 do { \
173181 if (BNCLogBreakPointsAreEnabled () { \
174- BNCLogMessageInternal (BNCLogLevelBreakPoint, __FILE__, __LINE__, __VA_ARGS__); \
182+ BNCLogWriteMessageFormat (BNCLogLevelBreakPoint, __FILE__, __LINE__, __VA_ARGS__); \
175183 if (BNCDebuggerIsAttached ()) { \
176184 BNCLogFlushMessages (); \
177185 BNCDebugBreakpoint (); \
@@ -183,7 +191,7 @@ extern void BNCLogFlushMessages();
183191#define BNCLogAssert (condition ) \
184192 do { \
185193 if (!(condition)) { \
186- BNCLogMessageInternal (BNCLogLevelAssert, __FILE__, __LINE__, @" (%s ) !!!" , #condition); \
194+ BNCLogWriteMessageFormat (BNCLogLevelAssert, __FILE__, __LINE__, @" (%s ) !!!" , #condition); \
187195 if (BNCLogBreakPointsAreEnabled () && BNCDebuggerIsAttached ()) { \
188196 BNCLogFlushMessages (); \
189197 BNCDebugBreakpoint (); \
@@ -197,7 +205,7 @@ extern void BNCLogFlushMessages();
197205 do { \
198206 if (!(condition)) { \
199207 NSString *m = [NSString stringWithFormat: message, __VA_ARGS__]; \
200- BNCLogMessageInternal (BNCLogLevelAssert, __FILE__, __LINE__, @" (%s ) !!! %@ " , #condition, m); \
208+ BNCLogWriteMessageFormat (BNCLogLevelAssert, __FILE__, __LINE__, @" (%s ) !!! %@ " , #condition, m); \
201209 if (BNCLogBreakPointsAreEnabled () && BNCDebuggerIsAttached ()) { \
202210 BNCLogFlushMessages (); \
203211 BNCDebugBreakpoint (); \
0 commit comments