@@ -37,7 +37,7 @@ Action::Action(event::Loop &loop, const std::string &type) :
37
37
38
38
Action::~Action () {
39
39
if (isUnderway ()) {
40
- LogWarn (" action %d:%s(%s) is still underway, state:%s" ,
40
+ LogWarn (" action %d:%s[%s] is still underway, state:%s" ,
41
41
id_, type_.c_str (), label_.c_str (),
42
42
ToString (state_).c_str ());
43
43
}
@@ -58,13 +58,13 @@ bool Action::start() {
58
58
return true ;
59
59
60
60
if (state_ != State::kIdle ) {
61
- LogWarn (" not allow" );
61
+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
62
62
return false ;
63
63
}
64
64
65
- LogDbg (" start action %d:%s(%s) " , id_, type_.c_str (), label_.c_str ());
65
+ LogDbg (" start action %d:%s[%s] " , id_, type_.c_str (), label_.c_str ());
66
66
if (!onStart ()) {
67
- LogWarn (" start action %d:%s(%s) fail" , id_, type_.c_str (), label_.c_str ());
67
+ LogWarn (" start action %d:%s[%s] fail" , id_, type_.c_str (), label_.c_str ());
68
68
return false ;
69
69
}
70
70
@@ -80,13 +80,13 @@ bool Action::pause() {
80
80
return true ;
81
81
82
82
if (state_ != State::kRunning ) {
83
- LogWarn (" not allow" );
83
+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
84
84
return false ;
85
85
}
86
86
87
- LogDbg (" pause action %d:%s(%s) " , id_, type_.c_str (), label_.c_str ());
87
+ LogDbg (" pause action %d:%s[%s] " , id_, type_.c_str (), label_.c_str ());
88
88
if (!onPause ()) {
89
- LogWarn (" pause action %d:%s(%s) fail" , id_, type_.c_str (), label_.c_str ());
89
+ LogWarn (" pause action %d:%s[%s] fail" , id_, type_.c_str (), label_.c_str ());
90
90
return false ;
91
91
}
92
92
@@ -102,13 +102,13 @@ bool Action::resume() {
102
102
return true ;
103
103
104
104
if (state_ != State::kPause ) {
105
- LogWarn (" not allow" );
105
+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
106
106
return false ;
107
107
}
108
108
109
- LogDbg (" resume action %d:%s(%s) " , id_, type_.c_str (), label_.c_str ());
109
+ LogDbg (" resume action %d:%s[%s] " , id_, type_.c_str (), label_.c_str ());
110
110
if (!onResume ()) {
111
- LogWarn (" resume action %d:%s(%s) fail" , id_, type_.c_str (), label_.c_str ());
111
+ LogWarn (" resume action %d:%s[%s] fail" , id_, type_.c_str (), label_.c_str ());
112
112
return false ;
113
113
}
114
114
@@ -124,9 +124,9 @@ bool Action::stop() {
124
124
state_ != State::kPause )
125
125
return true ;
126
126
127
- LogDbg (" stop action %d:%s(%s) " , id_, type_.c_str (), label_.c_str ());
127
+ LogDbg (" stop action %d:%s[%s] " , id_, type_.c_str (), label_.c_str ());
128
128
if (!onStop ()) {
129
- LogWarn (" stop action %d:%s(%s) fail" , id_, type_.c_str (), label_.c_str ());
129
+ LogWarn (" stop action %d:%s[%s] fail" , id_, type_.c_str (), label_.c_str ());
130
130
return false ;
131
131
}
132
132
@@ -141,7 +141,7 @@ void Action::reset() {
141
141
if (state_ == State::kIdle )
142
142
return ;
143
143
144
- LogDbg (" reset action %d:%s(%s) " , id_, type_.c_str (), label_.c_str ());
144
+ LogDbg (" reset action %d:%s[%s] " , id_, type_.c_str (), label_.c_str ());
145
145
onReset ();
146
146
147
147
if (timer_ev_ != nullptr )
@@ -152,13 +152,13 @@ void Action::reset() {
152
152
}
153
153
154
154
void Action::setTimeout (std::chrono::milliseconds ms) {
155
- LogDbg (" set action %d:%s(%s) timeout: %d" , id_, type_.c_str (), label_.c_str (), ms.count ());
155
+ LogDbg (" set action %d:%s[%s] timeout: %d" , id_, type_.c_str (), label_.c_str (), ms.count ());
156
156
157
157
if (timer_ev_ == nullptr ) {
158
158
timer_ev_ = loop_.newTimerEvent (" Action::timer_ev_" );
159
159
timer_ev_->setCallback (
160
160
[this ] {
161
- LogDbg (" action %d:%s(%s) timeout" , id_, type_.c_str (), label_.c_str ());
161
+ LogDbg (" action %d:%s[%s] timeout" , id_, type_.c_str (), label_.c_str ());
162
162
onTimeout ();
163
163
}
164
164
);
@@ -172,7 +172,7 @@ void Action::setTimeout(std::chrono::milliseconds ms) {
172
172
}
173
173
174
174
void Action::resetTimeout () {
175
- LogDbg (" reset action %d:%s(%s) timeout" , id_, type_.c_str (), label_.c_str ());
175
+ LogDbg (" reset action %d:%s[%s] timeout" , id_, type_.c_str (), label_.c_str ());
176
176
177
177
if (timer_ev_ != nullptr ) {
178
178
auto tobe_delete = timer_ev_;
@@ -185,7 +185,7 @@ void Action::resetTimeout() {
185
185
186
186
bool Action::finish (bool is_succ) {
187
187
if (state_ != State::kFinished ) {
188
- LogDbg (" action %d:%s(%s) finished, is_succ: %s" , id_, type_.c_str (), label_.c_str (),
188
+ LogDbg (" action %d:%s[%s] finished, is_succ: %s" , id_, type_.c_str (), label_.c_str (),
189
189
(is_succ? " succ" : " fail" ));
190
190
state_ = State::kFinished ;
191
191
@@ -197,13 +197,13 @@ bool Action::finish(bool is_succ) {
197
197
if (finish_cb_)
198
198
loop_.runNext (std::bind (finish_cb_, is_succ), " Action::finish" );
199
199
else
200
- LogWarn (" action %d:%s(%s) no finish_cb" , id_, type_.c_str (), label_.c_str ());
200
+ LogWarn (" action %d:%s[%s] no finish_cb" , id_, type_.c_str (), label_.c_str ());
201
201
202
202
onFinished (is_succ);
203
203
return true ;
204
204
205
205
} else {
206
- LogWarn (" not allow" );
206
+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
207
207
return false ;
208
208
}
209
209
}
0 commit comments