Skip to content

Commit

Permalink
Merge pull request #26 from cookpad/buffered-output
Browse files Browse the repository at this point in the history
BufferedOutput must be InstantiatableOutput
  • Loading branch information
Kohki Miki authored May 1, 2020
2 parents bb0b14b + fb8523f commit 58c3377
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/Puree/Output/BufferedOutput.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Foundation

open class BufferedOutput: Output {
open class BufferedOutput: InstantiatableOutput {
private let dateProvider: DateProvider = DefaultDateProvider()
internal let readWriteQueue = DispatchQueue(label: "com.cookpad.Puree.Logger.BufferedOutput", qos: .background)

public init(logStore: LogStore, tagPattern: TagPattern) {
required public init(logStore: LogStore, tagPattern: TagPattern, options: OutputOptions? = nil) {
self.logStore = logStore
self.tagPattern = tagPattern
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/PureeTests/LoggerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LoggerTests: XCTestCase {
XCTAssertEqual(buffer.logs(for: "pv").count, 1)

let log = buffer.logs(for: "pv").first!
guard let userInfo = try? JSONSerialization.jsonObject(with: log.userData!, options: []) as! [String: Any] else {
guard let userInfo = try? (JSONSerialization.jsonObject(with: log.userData!, options: []) as! [String: Any]) else {
return XCTFail("userInfo could not decoded")
}
XCTAssertEqual(userInfo["page_name"] as! String, "Top")
Expand Down Expand Up @@ -191,7 +191,7 @@ class LoggerTests: XCTestCase {

for index in testIndices {
let found = logs.contains { log -> Bool in
guard let userInfo = try? JSONSerialization.jsonObject(with: log.userData!, options: []) as! [String: Any] else {
guard let userInfo = try? JSONSerialization.jsonObject(with: log.userData!, options: []) as? [String: Any] else {
XCTFail("userInfo could not decoded")
return false
}
Expand Down

0 comments on commit 58c3377

Please sign in to comment.