Skip to content

Commit

Permalink
Prevented log messages from printing to the system when the debug fla…
Browse files Browse the repository at this point in the history
…g is not set.
  • Loading branch information
d108 committed Jan 26, 2017
1 parent 5d38984 commit 5f9ac5e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 77 deletions.
2 changes: 2 additions & 0 deletions IKILogger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "com.ikiApps.IKILogger-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -901,6 +902,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.ikiApps.IKILogger-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict />
</plist>

This file was deleted.

60 changes: 40 additions & 20 deletions Sources/IKILogger.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//
// IKILogger.swift
//
// version 2.0.1
// version 2.0.2
//
// The MIT License (MIT)
// Copyright (c) 2016 ikiApps LLC.
// Copyright (c) 2017 ikiApps LLC.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -228,25 +228,45 @@ private func logMultilineMessage(color: String,

for textLine in splitMessage {
#if CRASHLYTICS
if ikiLogger_useColor {
CLSNSLogv("\(ikiLogger_prefix) \(color) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
} else {
CLSNSLogv("\(ikiLogger_prefix) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
}
#if DEBUG
if ikiLogger_useColor {
CLSNSLogv("\(ikiLogger_prefix) \(color) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
} else {
CLSNSLogv("\(ikiLogger_prefix) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
}
#else
if ikiLogger_useColor {
CLSLog("\(ikiLogger_prefix) \(color) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
} else {
CLSLog("\(ikiLogger_prefix) -[%@:%d] %@ - %@",
getVaList([(filename as NSString).lastPathComponent,
line,
function,
textLine]))
}
#endif
#else
if ikiLogger_useColor {
NSLog("\(ikiLogger_prefix) \(color) -[\((filename as NSString).lastPathComponent):\(line)] \(function) - \(textLine)")
} else {
NSLog("\(ikiLogger_prefix) -[\((filename as NSString).lastPathComponent):\(line)] \(function) - \(textLine)")
}
#if DEBUG
if ikiLogger_useColor {
NSLog("\(ikiLogger_prefix) \(color) -[\((filename as NSString).lastPathComponent):\(line)] \(function) - \(textLine)")
} else {
NSLog("\(ikiLogger_prefix) -[\((filename as NSString).lastPathComponent):\(line)] \(function) - \(textLine)")
}
#else
// No message will be printed unless DEBUG is defined in the building settings under Other Swift Flags.
#endif
#endif
}
}

0 comments on commit 5f9ac5e

Please sign in to comment.