Expose Descriptor Logging
This commit is contained in:
Родитель
71831ed1b0
Коммит
509308ad28
|
@ -74,4 +74,13 @@
|
|||
*/
|
||||
+ (id<FBSimulatorLogger>)aslLoggerWritingToStderrr:(BOOL)writeToStdErr withDebugLogging:(BOOL)debugLogging;
|
||||
|
||||
/**
|
||||
An implementation of `FBSimulatorLogger` that logs all to a file descriptor using ASL.
|
||||
|
||||
@param fileDescriptor the file descriptor to log to, if 0 no file descriptor logging will occur.
|
||||
@param debugLogging YES if Debug messages should be written to stderr, NO otherwise.
|
||||
@return an FBSimulatorLogger instance.
|
||||
*/
|
||||
+ (id<FBSimulatorLogger>)aslLoggerWritingToFileDescriptor:(int)fileDescriptor withDebugLogging:(BOOL)debugLogging;
|
||||
|
||||
@end
|
||||
|
|
|
@ -135,14 +135,15 @@ static const char *FBASLClientDispatchLocal = "fbsimulatorcontrol_asl_client";
|
|||
|
||||
+ (id<FBSimulatorLogger>)aslLoggerWritingToStderrr:(BOOL)writeToStdErr withDebugLogging:(BOOL)debugLogging
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
static FBSimulatorLogger_ASL *logger;
|
||||
dispatch_once(&onceToken, ^{
|
||||
int fileDescriptor = writeToStdErr ? STDERR_FILENO : 0;
|
||||
FBASLClientManager *clientManager = [[FBASLClientManager alloc] initWithWritingToFileDescriptor:fileDescriptor debugLogging:debugLogging];
|
||||
asl_object_t client = [clientManager clientHandleForQueue:dispatch_get_main_queue()];
|
||||
logger = [[FBSimulatorLogger_ASL alloc] initWithClientManager:clientManager client:client currentLevel:ASL_LEVEL_INFO prefix:nil];
|
||||
});
|
||||
int fileDescriptor = writeToStdErr ? STDERR_FILENO : 0;
|
||||
return [self aslLoggerWritingToFileDescriptor:fileDescriptor withDebugLogging:debugLogging];
|
||||
}
|
||||
|
||||
+ (id<FBSimulatorLogger>)aslLoggerWritingToFileDescriptor:(int)fileDescriptor withDebugLogging:(BOOL)debugLogging
|
||||
{
|
||||
FBASLClientManager *clientManager = [[FBASLClientManager alloc] initWithWritingToFileDescriptor:fileDescriptor debugLogging:debugLogging];
|
||||
asl_object_t client = [clientManager clientHandleForQueue:dispatch_get_main_queue()];
|
||||
FBSimulatorLogger_ASL *logger = [[FBSimulatorLogger_ASL alloc] initWithClientManager:clientManager client:client currentLevel:ASL_LEVEL_INFO prefix:nil];
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче