this will be used by cli app.

Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
---
 ryu/plogger.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 ryu/plogger.py

diff --git a/ryu/plogger.py b/ryu/plogger.py
new file mode 100644
index 0000000..7204d43
--- /dev/null
+++ b/ryu/plogger.py
@@ -0,0 +1,27 @@
+# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+import logging
+
+
+class PrefixedLogger(logging.LoggerAdapter):
+    def __init__(self, logger, prefix):
+        logging.LoggerAdapter.__init__(self, logger, {})
+        self.__prefix = prefix
+
+    def process(self, msg, kwargs):
+        return ("%s %s" % (self.__prefix, msg), kwargs)
-- 
1.8.0.1


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to