@@ -11,12 +11,12 @@ import OSLog
11
11
import Pulse
12
12
#endif
13
13
14
- public protocol RemoteLoggerConnectionDelegate : AnyObject {
14
+ protocol RemoteLoggerConnectionDelegate : AnyObject {
15
15
func connection( _ connection: RemoteLogger . Connection , didChangeState newState: NWConnection . State )
16
16
func connection( _ connection: RemoteLogger . Connection , didReceiveEvent event: RemoteLogger . Connection . Event )
17
17
}
18
18
19
- public extension RemoteLogger {
19
+ extension RemoteLogger {
20
20
final class Connection {
21
21
var endpoint : NWEndpoint { connection. endpoint }
22
22
private let connection : NWConnection
@@ -31,15 +31,15 @@ public extension RemoteLogger {
31
31
self . init ( NWConnection ( to: endpoint, using: parameters) )
32
32
}
33
33
34
- public init ( _ connection: NWConnection , delegate: RemoteLoggerConnectionDelegate ? = nil ) {
34
+ init ( _ connection: NWConnection , delegate: RemoteLoggerConnectionDelegate ? = nil ) {
35
35
self . connection = connection
36
36
self . delegate = delegate
37
37
38
38
let isLogEnabled = UserDefaults . standard. bool ( forKey: " com.github.kean.pulse.debug " )
39
39
self . log = isLogEnabled ? OSLog ( subsystem: " com.github.kean.pulse " , category: " RemoteLogger " ) : . disabled
40
40
}
41
41
42
- public func start( on queue: DispatchQueue ) {
42
+ func start( on queue: DispatchQueue ) {
43
43
connection. stateUpdateHandler = { [ weak self] state in
44
44
guard let self = self else { return }
45
45
DispatchQueue . main. async {
@@ -50,15 +50,15 @@ public extension RemoteLogger {
50
50
connection. start ( queue: queue)
51
51
}
52
52
53
- public enum Event {
53
+ enum Event {
54
54
case packet( Packet )
55
55
case error( Error )
56
56
case completed
57
57
}
58
58
59
- public struct Packet {
60
- public let code : UInt8
61
- public let body : Data
59
+ struct Packet {
60
+ let code : UInt8
61
+ let body : Data
62
62
}
63
63
64
64
private func receive( ) {
@@ -131,7 +131,7 @@ public extension RemoteLogger {
131
131
}
132
132
}
133
133
134
- public func send( code: UInt8 , data: Data ) {
134
+ func send( code: UInt8 , data: Data ) {
135
135
do {
136
136
let data = try encode ( code: code, body: data)
137
137
let log = self . log
@@ -145,7 +145,7 @@ public extension RemoteLogger {
145
145
}
146
146
}
147
147
148
- public func send< T: Encodable > ( code: UInt8 , entity: T ) {
148
+ func send< T: Encodable > ( code: UInt8 , entity: T ) {
149
149
do {
150
150
let data = try JSONEncoder ( ) . encode ( entity)
151
151
send ( code: code, data: data)
@@ -207,7 +207,7 @@ public extension RemoteLogger {
207
207
}
208
208
}
209
209
210
- public func cancel( ) {
210
+ func cancel( ) {
211
211
connection. cancel ( )
212
212
}
213
213
}
0 commit comments