Skip to content

Commit

Permalink
Merge pull request #4 from shogo4405/v2.0.0
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
shogo4405 authored Nov 21, 2018
2 parents 2dcde19 + 4b8df54 commit 7c0e4f9
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Logboard.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "Logboard"
s.version = "1.2.1"
s.version = "2.0.0"
s.summary = "Simple Logging framework"

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion Platforms/macOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion Platforms/tvOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion Platforms/watchOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ logger.error("error")
## Requirements
|-|iOS|OSX|tvOS|watchOS|XCode|Swift|CocoaPods|Carthage|
|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|
|1.2.0|8.0+|10.9+|9.0+|2.0|10.0+|4.2|1.3.0|0.31.0+|
|1.1.0|8.0+|10.9+|9.0+|2.0|9.0+|4.0|1.2.0|0.20.0+|
|2.0.0+|8.0+|10.9+|9.0+|2.0|10.0+|4.2|1.3.0|0.31.0+|
|1.2.0+|8.0+|10.9+|9.0+|2.0|10.0+|4.2|1.3.0|0.31.0+|

## Installation
*Please set up your project Swift 4.2.*
Expand All @@ -33,7 +33,7 @@ source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

def import_pods
pod 'Logboard', '~> 1.2.1'
pod 'Logboard', '~> 2.0.0'
end

target 'Your Target' do
Expand All @@ -43,7 +43,7 @@ end
```
### Carthage
```
github "shogo4405/Logboard" ~> 1.2.1
github "shogo4405/Logboard" ~> 2.0.0
```

## Appenders
Expand Down
4 changes: 2 additions & 2 deletions Sources/ConsoleAppender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ public class ConsoleAppender: LogboardAppender {
public init() {
}

public func append(_ logboard: Logboard, level: Logboard.Level, message: String, file: StaticString, function: StaticString, line: Int) {
print(Logboard.dateFormatter.string(from: Date()), "[\(level)]", "[\(logboard.identifier)]", "[\(filename(file.description)):\(line)]", function, ">", message)
public func append(_ logboard: Logboard, level: Logboard.Level, message: [Any], file: StaticString, function: StaticString, line: Int) {
print(Logboard.dateFormatter.string(from: Date()), "[\(level)]", "[\(logboard.identifier)]", "[\(filename(file.description)):\(line)]", function, ">", message.map({ String(describing: $0) }).joined(separator: ""))
}
public func append(_ logboard: Logboard, level: Logboard.Level, format: String, arguments: CVarArg, file: StaticString, function: StaticString, line: Int) {
print(Logboard.dateFormatter.string(from: Date()), "[\(level)]", "[\(logboard.identifier)]", "[\(filename(file.description)):\(line)]", function, ">", String(format: format, arguments))
Expand Down
10 changes: 5 additions & 5 deletions Sources/Logboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class Logboard {
return self.level.rawValue <= level.rawValue
}

public func trace(_ message: String, file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
public func trace(_ message: Any..., file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
guard isEnabledFor(level: .trace) else { return }
appender.append(self, level: .trace, message: message, file: file, function: function, line: line)
}
Expand All @@ -82,7 +82,7 @@ public class Logboard {
appender.append(self, level: .trace, format: format, arguments: arguments, file: file, function: function, line: line)
}

public func debug(_ message: String, file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
public func debug(_ message: Any..., file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
guard isEnabledFor(level: .debug) else { return }
appender.append(self, level: .debug, message: message, file: file, function: function, line: line)
}
Expand All @@ -92,7 +92,7 @@ public class Logboard {
appender.append(self, level: .debug, format: format, arguments: arguments, file: file, function: function, line: line)
}

public func info(_ message: String, file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
public func info(_ message: Any..., file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
guard isEnabledFor(level: .info) else { return }
appender.append(self, level: .info, message: message, file: file, function: function, line: line)
}
Expand All @@ -102,7 +102,7 @@ public class Logboard {
appender.append(self, level: .info, format: format, arguments: arguments, file: file, function: function, line: line)
}

public func warn(_ message: String, file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
public func warn(_ message: Any..., file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
guard isEnabledFor(level: .warn) else { return }
appender.append(self, level: .warn, message: message, file: file, function: function, line: line)
}
Expand All @@ -112,7 +112,7 @@ public class Logboard {
appender.append(self, level: .warn, format: format, arguments: arguments, file: file, function: function, line: line)
}

public func error(_ message: String, file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
public func error(_ message: Any..., file: StaticString = #file, function: StaticString = #function, line: Int = #line) {
guard isEnabledFor(level: .error) else { return }
appender.append(self, level: .error, message: message, file: file, function: function, line: line)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/LogboardAppender.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public protocol LogboardAppender {
func append(_ logboard: Logboard, level: Logboard.Level, message: String, file: StaticString, function: StaticString, line: Int)
func append(_ logboard: Logboard, level: Logboard.Level, message: [Any], file: StaticString, function: StaticString, line: Int)
func append(_ logboard: Logboard, level: Logboard.Level, format: String, arguments: CVarArg, file: StaticString, function: StaticString, line: Int)
}
2 changes: 1 addition & 1 deletion Sources/MultiAppender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class MultiAppender: LogboardAppender {
public init() {
}

public func append(_ logboard: Logboard, level: Logboard.Level, message: String, file: StaticString, function: StaticString, line: Int) {
public func append(_ logboard: Logboard, level: Logboard.Level, message: [Any], file: StaticString, function: StaticString, line: Int) {
for appender in appenders {
appender.append(logboard, level: level, message: message, file: file, function: function, line: line)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/NullAppender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class NullAppender: LogboardAppender {
public init() {
}

public func append(_ logboard: Logboard, level: Logboard.Level, message: String, file: StaticString, function: StaticString, line: Int) {
public func append(_ logboard: Logboard, level: Logboard.Level, message: [Any], file: StaticString, function: StaticString, line: Int) {
}
public func append(_ logboard: Logboard, level: Logboard.Level, format: String, arguments: CVarArg, file: StaticString, function: StaticString, line: Int) {
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SocketAppender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public class SocketAppender: LogboardAppender {
socket.close(isDisconnected: false)
}

public func append(_ logboard: Logboard, level: Logboard.Level, message: String, file: StaticString, function: StaticString, line: Int) {
public func append(_ logboard: Logboard, level: Logboard.Level, message: [Any], file: StaticString, function: StaticString, line: Int) {
let strings: [String] = [
Logboard.dateFormatter.string(from: Date()),
level.description,
logboard.identifier,
file.description,
String(line),
function.description,
message
message.map({ String(describing: $0) }).joined(separator: "")
]
if let data: Data = (strings.joined(separator: "\t") + "\r\n\r\n").data(using: .utf8) {
socket.doOutput(data: data)
Expand Down

0 comments on commit 7c0e4f9

Please sign in to comment.