Skip to content

Commit

Permalink
Merge pull request #4 from sushichop/FIX/access-level
Browse files Browse the repository at this point in the history
Fix access level issue for use as a library.
  • Loading branch information
sushichop authored Oct 20, 2020
2 parents e5146ff + bf247d8 commit ebf3b35
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 14 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.1.1](https://github.com/sushichop/Puppy/releases/tag/0.1.1) (2020-10-20)

- Fix access level issue for use as a library. #4

## [0.1.0](https://github.com/sushichop/Puppy/releases/tag/0.1.0) (2020-10-18)

- First release
- First release.
2 changes: 1 addition & 1 deletion Configurations/Common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WATCHOS_DEPLOYMENT_TARGET = 3.0

SWIFT_VERSION = 5.0

MARKETING_VERSION = 0.1.0
MARKETING_VERSION = 0.1.1
DYLIB_CURRENT_VERSION = 1
CURRENT_PROJECT_VERSION = $(DYLIB_CURRENT_VERSION)

Expand Down
2 changes: 1 addition & 1 deletion Puppy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Puppy"
s.version = "0.1.0"
s.version = "0.1.1"
s.summary = "A flexible logging library written in Swift"
s.homepage = "https://github.com/sushichop/Puppy"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@

## Examples

**Logging to console and file using file log rotation feature.**
**Logging to console and file, then use log rotation feature about file.**

You can basically use CocoaPods, Carthage, and Swift Package Manager for integration.

```swift
import Puppy

let console = ConsoleLogger("com.example.yourapp.consolelogger")
let fileURL = URL(fileURLWithPath: "./rotation/foo.log").absoluteURL
let fileRotation = try FileRotationLogger("com.example.yourapp.filerotationlogger",
let fileRotation = try! FileRotationLogger("com.example.yourapp.filerotationlogger",
fileURL: fileURL)

fileRotation.maxFileSize = 10 * 1024 * 1024
Expand All @@ -51,6 +53,9 @@ You can use CocoaPods and Swift Package Manager for integration.
(`apple/swift-log` does not support Carthage integration.)

```swift
import Puppy
import Logging

let console = SystemLogger("com.example.yourapp.consolelogger")
let syslog = SystemLogger("com.example.yourapp.systemlogger")

Expand Down
2 changes: 1 addition & 1 deletion Sources/Puppy/BaseLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BaseLogger: Loggerable {
public var label: String
public var queue: DispatchQueue? { return nil }

init(_ label: String) {
public init(_ label: String) {
self.label = label
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Puppy/FileLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class FileLogger: BaseLogger {
private var fileHandle: FileHandle!
private let fileURL: URL

init(_ label: String, fileURL: URL) throws {
public init(_ label: String, fileURL: URL) throws {
self.fileURL = fileURL
debug("fileURL is \(fileURL)")
super.init(label)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Puppy/FileRotationLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class FileRotationLogger: BaseLogger {

public weak var delegate: FileRotationLoggerDeletate?

init(_ label: String, fileURL: URL) throws {
public init(_ label: String, fileURL: URL) throws {
self.fileURL = fileURL
debug("fileURL is \(fileURL)")
super.init(label)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Puppy/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ public protocol LogFormattable {
}

extension LogFormattable {
func shortFileName(_ file: String) -> String {
public func shortFileName(_ file: String) -> String {
return URL(fileURLWithPath: file).lastPathComponent
}
}

func dateFormatter(_ date: Date, locale: String = "en_US_POSIX", dateFormat: String = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", timeZone: String = "") -> String {
public func dateFormatter(_ date: Date, locale: String = "en_US_POSIX", dateFormat: String = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", timeZone: String = "") -> String {
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: locale)
dateFormatter.dateFormat = dateFormat
Expand Down
4 changes: 2 additions & 2 deletions Sources/Puppy/LogLevel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension LogLevel: CustomStringConvertible {
}

extension LogLevel {
var emoji: String {
public var emoji: String {
switch self {
case .trace:
return "🟤"
Expand All @@ -56,7 +56,7 @@ extension LogLevel {
}
}

var color: LogColor {
public var color: LogColor {
switch self {
case .trace:
return .darkGray
Expand Down
2 changes: 1 addition & 1 deletion Sources/Puppy/OSLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OSLogger: BaseLogger {

private let osLog: OSLog

init(_ label: String, category: String = "Puppy") {
public init(_ label: String, category: String = "Puppy") {
self.osLog = OSLog(subsystem: label, category: category)
super.init(label)
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/Puppy/Puppy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class Puppy {

public private(set) var loggers = Set<BaseLogger>()

public init() {}

public func add(_ logger: BaseLogger) {
if !(loggers.contains(logger)) {
loggers.insert(logger)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Puppy/PuppyLogHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct PuppyLogHandler: LogHandler {
private let label: String
private let puppy: Puppy

init(label: String, puppy: Puppy, metadata: Logger.Metadata = [:]) {
public init(label: String, puppy: Puppy, metadata: Logger.Metadata = [:]) {
self.label = label
self.puppy = puppy
self.metadata = metadata
Expand Down

0 comments on commit ebf3b35

Please sign in to comment.