Skip to content

Commit

Permalink
Swift active and v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drekka committed Oct 24, 2016
1 parent eb3b7a8 commit 498945c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Story Teller is an advanced logging framework that takes an entirely different a

See how it works on the main [Story Teller site](http://drekka.github.io/StoryTeller).

# v1.7.6
# v1.8.0

* First cut of adding support for Swift. STLog(...), STStarScope(...) and STStartLogging(...) all working.
* Fixed issues where missing Foundation import in PEGKit generated code was causing compilation failues.

# V1.7.5
Expand All @@ -24,7 +25,7 @@ See how it works on the main [Story Teller site](http://drekka.github.io/StoryTe

* Fixing bug where a weakly referenced key would crash the app if logging was done in a dealloc.

# V1.7.2 #
# V1.7.2

* Added option to log the thread number.
* Added option to draw a picture of the thread similar to a git branch view as the logging occurs. The ASCII based character image illustrates which messages are on the main thread and which are on background threads.
Expand Down
6 changes: 4 additions & 2 deletions StoryTeller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
6C9E1A7D1B44D0C100763905 /* ExpectsProtocolTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ExpectsProtocolTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
6CA7DF031B3A61D7002491FF /* STLogExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STLogExpressionParser.h; sourceTree = "<group>"; };
6CA7DF041B3A61D7002491FF /* STLogExpressionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = STLogExpressionParser.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
6CBA678E1DBE363300993C6D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
6CBABD1F1D5B48A400E44EC4 /* STInternalMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = STInternalMacros.h; sourceTree = "<group>"; };
6CC458A71B4FEBD700FA0EA9 /* STMatcherFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = STMatcherFactory.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
6CC458A81B4FEBD700FA0EA9 /* STMatcherFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = STMatcherFactory.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
Expand Down Expand Up @@ -322,6 +323,7 @@
6CE5C3DB1B329BD100F0A470 = {
isa = PBXGroup;
children = (
6CBA678E1DBE363300993C6D /* README.md */,
6CE8993F1D8FA74E00A1983F /* Cartfile.private */,
6C3F07EA1D33DF5000166A39 /* Cartfile */,
F469EAC31CEAE53E00D9DD47 /* Frameworks */,
Expand Down Expand Up @@ -789,7 +791,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.7.6;
CURRENT_PROJECT_VERSION = 1.8.0;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1.7;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -860,7 +862,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.7.6;
CURRENT_PROJECT_VERSION = 1.8.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1.7;
ENABLE_NS_ASSERTIONS = NO;
Expand Down
1 change: 0 additions & 1 deletion StoryTeller/STDeallocHook.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ -(instancetype) initWithBlock:(void (^)(void)) simpleBlock {
}

-(void) dealloc {
NSLog(@"Deallocin");
_deallocBlock();
}

Expand Down
7 changes: 5 additions & 2 deletions StoryTeller/StoryTellerSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public func STLog(_ key:AnyObject, file:String = #file, method:String = #functio
}
}

public func STStartScope(_ key:AnyObject) -> Any {
return STStoryTeller.instance().startScope(key)
public func STStartScope(_ key:AnyObject, _ block:() -> Void) {
let x = STStoryTeller.instance().startScope(key)
block()
let _ = x
// STStoryTeller.instance().endScope(key)
}
15 changes: 6 additions & 9 deletions StoryTellerTests/STSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,19 @@ class STSwiftTests: XCTestCase {

func testScopeActive() {
STStartLogging("[StoryTellerTests.STSwiftTests]")
let _ = STStartScope(self)
print("1st log")
STLog("xyz" as NSString, "Hello")
validateLogLine(0, methodName: "testBaseLogging", lineNumber: #line - 1, message: "Hello")
STStartScope(self) {
STLog("xyz" as NSString, "Hello")
}
validateLogLine(0, methodName: "testBaseLogging", lineNumber: #line - 2, message: "Hello")
}

func testScopeNestedActive() {
STStartLogging("[StoryTellerTests.STSwiftTests]")
if true {
let _ = STStartScope(self)
print("1st log")
STStartScope(self) {
STLog("xyz" as NSString, "Hello")
}
print("2st log")
STLog("xyz" as NSString, "Hello 2")
validateLogLine(0, methodName: "testBaseLogging", lineNumber: #line - 4, message: "Hello")
validateLogLine(0, methodName: "testBaseLogging", lineNumber: #line - 3, message: "Hello")
XCTAssertEqual(1, _inMemoryLogger.log.count)
}

Expand Down

0 comments on commit 498945c

Please sign in to comment.