Skip to content

Commit

Permalink
chore: use debugPrint
Browse files Browse the repository at this point in the history
  • Loading branch information
r13v committed Jul 7, 2023
1 parent b5301f2 commit e7a1666
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
18 changes: 9 additions & 9 deletions Effector/Debug.swift
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
extension Store {
public extension Store {
@discardableResult
func debug() -> Self {
self.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

return self
}
}

extension Event {
public extension Event {
@discardableResult
func debug() -> Self {
self.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

return self
}
}

extension Effect {
public extension Effect {
@discardableResult
func debug() -> Self {
self.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

self.pending.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

self.done.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

self.fail.watch {
print("\(self.graphite) -> ", $0)
debugPrint("\(self.graphite) -> \(String(describing: $0))")
}

return self
Expand Down
14 changes: 0 additions & 14 deletions Effector/Kernel.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
let DEBUG = false

func debugPrint(_ message: String) {
if DEBUG {
print(message)
}
}

func exec() {
debugPrint("--- exec ---")

cycle: while let element = Queue.shared.dequeue() {
let node = element.node
var value = element.value

debugPrint("cycle \(node), \(value)")

for step in node.seq {
switch step {
case let .compute(_, fn):
Expand All @@ -30,8 +18,6 @@ func exec() {
}

for nextNode in element.node.next {
debugPrint("enqueue \(node), \(value)")

Queue.shared.enqueue(nextNode, value)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.7

import PackageDescription

Expand Down

0 comments on commit e7a1666

Please sign in to comment.