@@ -172,25 +172,33 @@ public <S extends Service> S loadService(final Class<S> c) {
172172 * instantiated
173173 */
174174 public <S extends Service > S createExactService (final Class <S > c ) {
175- log .debug ("Creating service: " + c .getName (), null );
175+ final String name = c .getName ();
176+ log .debug ("Creating service: " + name , null );
176177 try {
178+ long start = 0 , end = 0 ;
179+ boolean debug = log .isDebug ();
180+ if (debug ) start = System .currentTimeMillis ();
177181 final S service = createService (c );
178182 getContext ().getServiceIndex ().add (service );
179- log .info ("Created service: " + c .getName ());
183+ if (debug ) end = System .currentTimeMillis ();
184+ log .info ("Created service: " + name );
185+ if (debug ) {
186+ log .debug ("\t [" + name + " created in " + (end - start ) + " ms]" );
187+ }
180188 return service ;
181189 }
182190 catch (final Throwable t ) {
183191 if (log .isDebug ()) {
184192 // when in debug mode, always give full stack trace of invalid services
185- log .debug ("Invalid service: " + c . getName () , t );
193+ log .debug ("Invalid service: " + name , t );
186194 }
187195 else if (!Optional .class .isAssignableFrom (c )) {
188196 // for required (i.e., non-optional) services, we also dump the stack
189- log .warn ("Invalid service: " + c . getName () , t );
197+ log .warn ("Invalid service: " + name , t );
190198 }
191199 else {
192200 // we emit only a short warning for failing optional services
193- log .warn ("Invalid service: " + c . getName () );
201+ log .warn ("Invalid service: " + name );
194202 }
195203 }
196204 return null ;
0 commit comments