static void LogStream()

in TwitterLoggingServiceTests/TLSLoggingTests.m [1073:1097]


static void LogStream(id<TLSOutputStream> stream, TLSLogLevel level, NSString *channel, NSString *file, NSString *function, unsigned int line, NSString *format, ...)
{
    NSDate *timestamp = [NSDate date];
    va_list list;
    va_start(list, format);
    TLSLogMessageInfo *info = [[TLSLogMessageInfo alloc] initWithLevel:level
                                                                  file:file
                                                              function:function
                                                                  line:line
                                                               channel:channel
                                                             timestamp:timestamp
                                                           logLifespan:[timestamp timeIntervalSinceDate:[[TLSLoggingService sharedInstance] startupTimestamp]]
                                                              threadId:pthread_mach_thread_np(pthread_self())
                                                            threadName:TLSCurrentThreadName()
                                                         contextObject:nil
                                                               message:[[NSString alloc] initWithFormat:format arguments:list]];
    va_end(list);
    __block BOOL isChannelOn = NO;
    [[TLSLoggingService sharedInstance] dispatchSynchronousTransaction:^{
        isChannelOn = IsConsoleChannelOn(channel);
    }];
    if (isChannelOn) {
        [stream tls_outputLogInfo:info];
    }
}