Remove private _SULogDisableStandardErrorStream() function

When using ASL, don't log to stderr if a terminal is attached. This behavior closely matches os_log()
This commit is contained in:
Zorg committed 2017-01-05 23:09:58 -05:00
1 parent e1a4ad9371
commit af0a88dab3
3 files changed
+4 -19

No files matched your search

+2
View File
@@ -19,6 +19,8 @@ typedef NS_ENUM(uint8_t, SULogLevel) {
// Logging utlity function that is thread-safe
// On 10.12 or later this uses os_log
// Otherwise on older systems this uses ASL
// For debugging command line tools, you may have to use Console.app to view log messages
// Try to keep log messages as compact/short as possible
void SULog(SULogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
#endif
+2 -13
View File
@@ -16,22 +16,10 @@
#error This is a "core" implementation and should NOT import AppKit
#endif
void _SULogDisableStandardErrorStream(void);
static BOOL gDisableStandardErrorStream;
// For converting constants to string literals using the preprocessor
#define STRINGIFY(x) #x
#define TO_STRING(x) STRINGIFY(x)
// Private API for disable logging to standard error stream
// We don't want to do this normally unless eg: releasing a command line utility,
// because it may be useful for error output to show up in an immediately visible terminal/panel
// Note this is only necessary for the older ASL API. This is effectively a no-op when os_log is available (10.12+)
SU_EXPORT void _SULogDisableStandardErrorStream(void)
{
gDisableStandardErrorStream = YES;
}
void SULog(SULogLevel level, NSString *format, ...)
{
static aslclient client;
@@ -57,7 +45,8 @@ void SULog(SULogLevel level, NSString *format, ...)
#pragma clang diagnostic pop
} else {
uint32_t options = ASL_OPT_NO_DELAY;
if (!gDisableStandardErrorStream) {
// Act the same way os_log() does; don't log to stderr if a terminal device is attached
if (!isatty(STDERR_FILENO)) {
options |= ASL_OPT_STDERR;
}
-6
View File
@@ -10,8 +10,6 @@
#import <SparkleCore/SparkleCore.h>
#import "SPUCommandLineUserDriver.h"
void _SULogDisableStandardErrorStream(void);
@interface SPUCommandLineDriver () <SPUUpdaterDelegate>
@property (nonatomic, readonly) SPUUpdater *updater;
@@ -53,10 +51,6 @@ void _SULogDisableStandardErrorStream(void);
_interactive = interactiveInstallation;
_customFeedURL = [customFeedURL copy];
#ifndef DEBUG
_SULogDisableStandardErrorStream();
#endif
id <SPUUserDriver> userDriver = [[SPUCommandLineUserDriver alloc] initWithUpdatePermissionResponse:updatePermissionResponse deferInstallation:deferInstallation verbose:verbose];
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
}