On Wed, Mar 06, 2013 at 11:05:54AM +0900, Isaku Yamahata wrote:
> On Tue, Mar 05, 2013 at 01:18:07PM +0900, YAMAMOTO Takashi wrote:
> > this will be used by management api.
> > 
> > Signed-off-by: YAMAMOTO Takashi <[email protected]>
> > ---
> >  bin/ryu-manager |  1 +
> >  ryu/logger.py   | 31 +++++++++++++++++++++++++++++++
> >  2 files changed, 32 insertions(+)
> >  create mode 100644 ryu/logger.py
> > 
> > diff --git a/bin/ryu-manager b/bin/ryu-manager
> > index 03b1b79..18a38d6 100755
> > --- a/bin/ryu-manager
> > +++ b/bin/ryu-manager
> > @@ -33,6 +33,7 @@ from oslo.config import cfg
> >  import logging
> >  import sys
> >  
> > +import ryu.logger
> >  from ryu import log
> >  log.early_init_log(logging.DEBUG)
> >  
> > diff --git a/ryu/logger.py b/ryu/logger.py
> > new file mode 100644
> > index 0000000..2e2aa91
> > --- /dev/null
> > +++ b/ryu/logger.py
> > @@ -0,0 +1,31 @@
> > +# 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 RyuLogger(logging.getLoggerClass()):
> > +    loggers = set()
> > +
> > +    def __init__(self, name):
> > +        try:
> > +            super(RyuLogger, self).__init__(name)
> > +        except TypeError:
> > +            # probably our super class is old-type
> > +            logging.Logger.__init__(self, name)
> > +        RyuLogger.loggers.add(name)
> 
> Doesn't this prevent from GCing logger?

Ah, it records only name. __del__() is needed to delete name.


> 
> 
> > +
> > +logging.setLoggerClass(RyuLogger)
> > -- 
> > 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
> > 
> 
> -- 
> yamahata
> 
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
> endpoint security space. For insight on selecting the right partner to 
> tackle endpoint security challenges, access the full report. 
> http://p.sf.net/sfu/symantec-dev2dev
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

-- 
yamahata

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to