Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
move to swift2 should be complete
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsvu committed Oct 5, 2015
1 parent 2b928bb commit f936e08
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 13 deletions.
1 change: 0 additions & 1 deletion Evergreen.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This playground showcases some basic features of the Evergreen framework. Consul

import Evergreen


log("Hello World!") // Look at the console output!


Expand Down
2 changes: 1 addition & 1 deletion Evergreen.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' requires-full-environment='true'>
<playground version='5.0' target-platform='ios' requires-full-environment='true' last-migration='0700'>
<timeline fileName='timeline.xctimeline'/>
</playground>
6 changes: 3 additions & 3 deletions Evergreen.podspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Pod::Spec.new do |s|
s.name = "Evergreen"
s.version = "0.5.0"
s.version = "0.6.0"
s.summary = "A Swift Logging Framework."
s.description = <<-DESC
Evergreen is a logging framework written in Swift.
It's all about replacing your `println()` statements with calls to Evergreen's versatile `log()` functions. Configure a logger hierarchy with log levels for your App or framework and use it to controle the verbosity of your software's output. Use handlers and formatters to control the way log events are handled.
It's all about replacing your `print()` statements with calls to Evergreen's versatile `log()` functions. Configure a logger hierarchy with log levels for your App or framework and use it to controle the verbosity of your software's output. Use handlers and formatters to control the way log events are handled.
DESC
s.homepage = "http://github.com/viWiD/Evergreen"
s.license = { :type => "MIT", :file => "LICENSE.md" }
s.author = { "Nils Fischer" => "n.fischer@viwid.com" }
s.platform = :ios, "8.0"
s.source = { :git => "https://github.com/viWiD/Evergreen.git", :tag => "v0.5.0" }
s.source = { :git => "https://github.com/viWiD/Evergreen.git", :tag => "v0.6.0" }
s.source_files = "Evergreen"
end
1 change: 1 addition & 0 deletions Evergreen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
87539B1619DB23F00084658D /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "viWiD Webdesign & iOS Development";
Expand Down
2 changes: 1 addition & 1 deletion Evergreen/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class Formatter {

public func stringFromEvent<M>(event: Event<M>) -> String
{
var string = "".join(components.map { $0.stringForEvent(event) })
var string = components.map({ $0.stringForEvent(event) }).joinWithSeparator("")

if let elapsedTime = event.elapsedTime {
string += " [ELAPSED TIME: \(elapsedTime)s]"
Expand Down
4 changes: 4 additions & 0 deletions Evergreen/Handler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public class StenographyHandler: Handler {
/// All records logged to this handler
public private(set) var records: [Record] = []

public convenience init() {
self.init(formatter: Formatter(style: .Default))
}

override public func emitRecord(record: Record) {
self.records.append(record)
}
Expand Down
8 changes: 5 additions & 3 deletions Evergreen/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public final class Logger {
} else {
if !wasHandled {
// TODO: use println() directly? Using log() will cause an endless loop when defaultLogger does not have any handlers.
print("Tried to log an event for logger '\(event.logger)', but no handler was found in the logger hierarchy to emit the event: \(event.file.lastPathComponent):\(event.line) \(event.function)")
print("Tried to log an event for logger '\(event.logger)', but no handler was found in the logger hierarchy to emit the event: \(event.file):\(event.line) \(event.function)")
}
}
}
Expand Down Expand Up @@ -300,7 +300,9 @@ public final class Logger {

/// Returns an appropriate logger for the given file. Generally, the logger's key will be the file name and it will be a direct child of the default logger.
public class func loggerForFile(file: String = __FILE__) -> Logger {
let key = file.lastPathComponent
guard let fileURL = NSURL(string: file), let key = fileURL.lastPathComponent else {
return Evergreen.defaultLogger
}
return self.loggerForKeyPath(KeyPath(components: [ key ]))
}

Expand Down Expand Up @@ -374,7 +376,7 @@ public final class Logger {
}

public func description(separator separator: String? = nil) -> String {
return (separator ?? ".").join(components)
return components.joinWithSeparator(separator ?? ".")
}
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Evergreen is a logging framework written in Swift. It is designed to work just as you would expect, yet so versatile you can make it work however you wish.

Integrate Evergreen logging into your Swift project to replace those plain `println()` statements with calls to Evergreen's versatile logging functions that make it easy to **adjust the verbosity** of the output, log to **multiple destinations** (e.g. a file) with **custom formatting** and even **measure time**.
Integrate Evergreen logging into your Swift project to replace those plain `print()` statements with calls to Evergreen's versatile logging functions that make it easy to **adjust the verbosity** of the output, log to **multiple destinations** (e.g. a file) with **custom formatting** and even **measure time**.

```swift
import Evergreen
Expand Down
6 changes: 5 additions & 1 deletion iOS Example/iOS Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@
873767B21AEC52CD009A703F /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0630;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "viWiD Webdesign & iOS Development";
TargetAttributes = {
873767B91AEC52CD009A703F = {
Expand Down Expand Up @@ -203,6 +204,7 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -272,6 +274,7 @@
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "iOS Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.viwid.Evergreen.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -283,6 +286,7 @@
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "iOS Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.viwid.Evergreen.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion iOS Example/iOS Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.viwid.Evergreen.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion iOS Example/iOS Example/RecordListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RecordListViewController: UITableViewController {

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let record = stenographyHandler.records.reverse()[indexPath.row]
let cell = tableView.dequeueReusableCellWithIdentifier("recordCell", forIndexPath: indexPath) as! UITableViewCell
let cell = tableView.dequeueReusableCellWithIdentifier("recordCell", forIndexPath: indexPath)
cell.textLabel?.text = record.description
return cell
}
Expand Down

0 comments on commit f936e08

Please sign in to comment.