this will be used by cli app. Signed-off-by: YAMAMOTO Takashi <[email protected]> --- ryu/base/management.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 ryu/base/management.py
diff --git a/ryu/base/management.py b/ryu/base/management.py new file mode 100644 index 0000000..55ae7dc --- /dev/null +++ b/ryu/base/management.py @@ -0,0 +1,57 @@ +# 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. + +# internal management api + +import logging + +import ryu.logger + + +def set_log_level(name, newlvl): + """ + Set the log level of the specified logger + """ + if not name in ryu.logger.RyuLogger.loggers: + raise LookupError + logger = logging.getLogger(name) + oldlvl = logger.getEffectiveLevel() + logger.setLevel(newlvl) + + +def get_log_level(name): + """ + Return the log level of the specified logger + """ + if not name in ryu.logger.RyuLogger.loggers: + raise LookupError + logger = logging.getLogger(name) + return logger.getEffectiveLevel() + + +def list_loggers(): + """ + Return a list of logger names + """ + return ryu.logger.RyuLogger.loggers + + +def list_bricks(): + """ + Return a list of configured bricks + """ + from ryu.base.app_manager import SERVICE_BRICKS + return SERVICE_BRICKS.keys() -- 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_feb _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
