Package libxyz :: Package core :: Package logger :: Module loglevel |
[hide private]
[frames] | no frames]

# Source Code for Module libxyz.core.logger.loglevel

     1  #-*- coding: utf8 -*
     2  #
     3  # Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
     4  #
     5  # This file is part of XYZCommander.
     6  # XYZCommander is free software: you can redistribute it and/or modify
     7  # it under the terms of the GNU Lesser Public License as published by
     8  # the Free Software Foundation, either version 3 of the License, or
     9  # (at your option) any later version.
    10  # XYZCommander is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  # GNU Lesser Public License for more details.
    14  # You should have received a copy of the GNU Lesser Public License
    15  # along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.
    16
    17 -class LogLevel(object):
    18      """
    19      Available log levels
    20      """
    21
    22 -    def __init__(self):
    23          self._levels = {"NONE": 0,
    24                          "ERROR": 1,
    25                          "WARNING": 2,
    26                          "INFO": 4,
    27                          "DEBUG": 8,
    28                          "UNKNOWN": 16,
    29                          "PANIC": 32,
    30                          "ALL": 63,
    31                          }
    32
    33          self._str_levels = dict([(v, k) for k, v in self._levels.iteritems()])
    34
    35          for _k, _v in self._levels.iteritems():
    36              setattr(self, _k, _v)
    37
    38      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    39
    40 -    def str_level(self, level):
    41          """
    42          Return string level representation
    43          """
    44
    45          return self._str_levels[level]
    46