about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-02-01 18:59:13 -0500
committerDrew DeVault <sir@cmpwn.com>2018-02-01 18:59:13 -0500
commit1767e4fab515cefba08345e6eb2c84f46daf4be1 (patch)
tree562b1f2269df58b4c783a771ac0324ce32ec7bb1 /worker
parentd24e4712a45e03d79fa1ccb71d00c5b830d5a305 (diff)
downloadaerc-1767e4fab515cefba08345e6eb2c84f46daf4be1.tar.gz
Improve logging
Diffstat (limited to 'worker')
-rw-r--r--worker/types/worker.go26
1 files changed, 20 insertions, 6 deletions
diff --git a/worker/types/worker.go b/worker/types/worker.go
index a99d432..1ff16a4 100644
--- a/worker/types/worker.go
+++ b/worker/types/worker.go
@@ -19,7 +19,11 @@ type Worker struct {
 func (worker *Worker) PostAction(msg WorkerMessage,
 	cb func(msg WorkerMessage)) {
 
-	worker.Logger.Printf("=> %T\n", msg)
+	if resp := msg.InResponseTo(); resp != nil {
+		worker.Logger.Printf("(ui)=> %T:%T\n", msg, resp)
+	} else {
+		worker.Logger.Printf("(ui)=> %T\n", msg)
+	}
 	worker.Actions <- msg
 
 	if cb != nil {
@@ -30,7 +34,11 @@ func (worker *Worker) PostAction(msg WorkerMessage,
 func (worker *Worker) PostMessage(msg WorkerMessage,
 	cb func(msg WorkerMessage)) {
 
-	worker.Logger.Printf("-> %T\n", msg)
+	if resp := msg.InResponseTo(); resp != nil {
+		worker.Logger.Printf("->(ui) %T:%T\n", msg, resp)
+	} else {
+		worker.Logger.Printf("->(ui) %T\n", msg)
+	}
 	worker.Messages <- msg
 
 	if cb != nil {
@@ -39,8 +47,11 @@ func (worker *Worker) PostMessage(msg WorkerMessage,
 }
 
 func (worker *Worker) ProcessMessage(msg WorkerMessage) WorkerMessage {
-
-	worker.Logger.Printf("<= %T\n", msg)
+	if resp := msg.InResponseTo(); resp != nil {
+		worker.Logger.Printf("(ui)<= %T:%T\n", msg, resp)
+	} else {
+		worker.Logger.Printf("(ui)<= %T\n", msg)
+	}
 	if cb, ok := worker.Callbacks[msg.InResponseTo()]; ok {
 		cb(msg)
 		delete(worker.Callbacks, msg)
@@ -49,8 +60,11 @@ func (worker *Worker) ProcessMessage(msg WorkerMessage) WorkerMessage {
 }
 
 func (worker *Worker) ProcessAction(msg WorkerMessage) WorkerMessage {
-
-	worker.Logger.Printf("<- %T\n", msg)
+	if resp := msg.InResponseTo(); resp != nil {
+		worker.Logger.Printf("<-(ui) %T:%T\n", msg, resp)
+	} else {
+		worker.Logger.Printf("<-(ui) %T\n", msg)
+	}
 	if cb, ok := worker.Callbacks[msg.InResponseTo()]; ok {
 		cb(msg)
 		delete(worker.Callbacks, msg)
ame/doc/pydoc/ranger.gui.curses_shortcuts.html?h=v1.8.1&id=2ca2e862e616eba862ac80f5ee0003d1aa984a32'>^
34a60763 ^
4c13e1f2 ^






34a60763 ^
4c13e1f2 ^
34a60763 ^
4c13e1f2 ^












62cd83ba ^
4c13e1f2 ^
b3556b21 ^
4c13e1f2 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93