@@ -37,7 +37,7 @@ Action::Action(event::Loop &loop, const std::string &type) :
3737
3838Action::~Action () {
3939 if (isUnderway ()) {
40- LogWarn (" action %d:%s(%s) is still underway, state:%s" ,
40+ LogWarn (" action %d:%s[%s] is still underway, state:%s" ,
4141 id_, type_.c_str (), label_.c_str (),
4242 ToString (state_).c_str ());
4343 }
@@ -58,13 +58,13 @@ bool Action::start() {
5858 return true ;
5959
6060 if (state_ != State::kIdle ) {
61- LogWarn (" not allow" );
61+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
6262 return false ;
6363 }
6464
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 ());
6666 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 ());
6868 return false ;
6969 }
7070
@@ -80,13 +80,13 @@ bool Action::pause() {
8080 return true ;
8181
8282 if (state_ != State::kRunning ) {
83- LogWarn (" not allow" );
83+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
8484 return false ;
8585 }
8686
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 ());
8888 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 ());
9090 return false ;
9191 }
9292
@@ -102,13 +102,13 @@ bool Action::resume() {
102102 return true ;
103103
104104 if (state_ != State::kPause ) {
105- LogWarn (" not allow" );
105+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
106106 return false ;
107107 }
108108
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 ());
110110 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 ());
112112 return false ;
113113 }
114114
@@ -124,9 +124,9 @@ bool Action::stop() {
124124 state_ != State::kPause )
125125 return true ;
126126
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 ());
128128 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 ());
130130 return false ;
131131 }
132132
@@ -141,7 +141,7 @@ void Action::reset() {
141141 if (state_ == State::kIdle )
142142 return ;
143143
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 ());
145145 onReset ();
146146
147147 if (timer_ev_ != nullptr )
@@ -152,13 +152,13 @@ void Action::reset() {
152152}
153153
154154void 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 ());
156156
157157 if (timer_ev_ == nullptr ) {
158158 timer_ev_ = loop_.newTimerEvent (" Action::timer_ev_" );
159159 timer_ev_->setCallback (
160160 [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 ());
162162 onTimeout ();
163163 }
164164 );
@@ -172,7 +172,7 @@ void Action::setTimeout(std::chrono::milliseconds ms) {
172172}
173173
174174void 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 ());
176176
177177 if (timer_ev_ != nullptr ) {
178178 auto tobe_delete = timer_ev_;
@@ -185,7 +185,7 @@ void Action::resetTimeout() {
185185
186186bool Action::finish (bool is_succ) {
187187 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 (),
189189 (is_succ? " succ" : " fail" ));
190190 state_ = State::kFinished ;
191191
@@ -197,13 +197,13 @@ bool Action::finish(bool is_succ) {
197197 if (finish_cb_)
198198 loop_.runNext (std::bind (finish_cb_, is_succ), " Action::finish" );
199199 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 ());
201201
202202 onFinished (is_succ);
203203 return true ;
204204
205205 } else {
206- LogWarn (" not allow" );
206+ LogWarn (" not allow %d:%s[%s] " , id_, type_. c_str (), label_. c_str () );
207207 return false ;
208208 }
209209}
0 commit comments