66use Cake \Utility \Inflector ;
77use Muffin \Webservice \Exception \MissingWebserviceClassException ;
88use Muffin \Webservice \Exception \UnimplementedWebserviceMethodException ;
9- use Muffin \Webservice \Webservice \Webservice ;
109use Muffin \Webservice \Webservice \WebserviceInterface ;
1110use Psr \Log \LoggerAwareInterface ;
1211use Psr \Log \LoggerAwareTrait ;
@@ -111,12 +110,24 @@ public function webservice($name, WebserviceInterface $webservice = null)
111110 * Returns a logger instance
112111 *
113112 * @return \Psr\Log\LoggerInterface
113+ *
114+ * @deprecated 1.4.0 Use getLogger() instead.
114115 */
115116 public function logger ()
116117 {
117118 return $ this ->logger ;
118119 }
119120
121+ /**
122+ * Returns a logger instance
123+ *
124+ * @return \Psr\Log\LoggerInterface
125+ */
126+ public function getLogger ()
127+ {
128+ return $ this ->logger ;
129+ }
130+
120131 /**
121132 * Returns the connection name used in the configuration
122133 *
@@ -134,6 +145,8 @@ public function configName()
134145 * Use null to read current value.
135146 *
136147 * @return bool
148+ *
149+ * @deprecated 1.4.0 Use enableQueryLogging()/disableQueryLogging()/isQueryLoggingEnabled() instead.
137150 */
138151 public function logQueries ($ enable = null )
139152 {
@@ -144,6 +157,40 @@ public function logQueries($enable = null)
144157 $ this ->_logQueries = $ enable ;
145158 }
146159
160+ /**
161+ * Enable/disable query logging
162+ *
163+ * @return $this
164+ */
165+ public function enableQueryLogging ()
166+ {
167+ $ this ->_logQueries = true ;
168+
169+ return $ this ;
170+ }
171+
172+ /**
173+ * Disable query logging
174+ *
175+ * @return $this
176+ */
177+ public function disableQueryLogging ()
178+ {
179+ $ this ->_logQueries = false ;
180+
181+ return $ this ;
182+ }
183+
184+ /**
185+ * Check if query logging is enabled.
186+ *
187+ * @return bool
188+ */
189+ public function isQueryLoggingEnabled ()
190+ {
191+ return $ this ->_logQueries ;
192+ }
193+
147194 /**
148195 * Proxies the client's methods.
149196 *
@@ -183,7 +230,7 @@ public function __debugInfo()
183230 {
184231 return [
185232 'client ' => $ this ->client (),
186- 'logger ' => $ this ->logger (),
233+ 'logger ' => $ this ->getLogger (),
187234 'webservices ' => array_keys ($ this ->_webservices )
188235 ];
189236 }
0 commit comments