# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals

import sys
import logging

# Import log levels.
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL

# Define the default logging format.
_DEFAULT_FORMAT = '[%(name)s] %(asctime)s: (%(levelname)s) %(message)s'

# Define the defualt logger which does nothing.
class _NullHandler(logging.Handler):
  def emit(self, record):
    pass

_logger = logging.getLogger('jubakit')
_logger.addHandler(_NullHandler())
_logger.setLevel(logging.CRITICAL)

def setup_logger(level=logging.WARNING, f=sys.stderr, log_format=_DEFAULT_FORMAT):
  """
  Convenient method to setup the logger.
  """
  handler = logging.StreamHandler(f)
  handler.setFormatter(logging.Formatter(log_format))

  _logger.propagate = False
  _logger.addHandler(handler)
  _logger.setLevel(level)

def get_logger(name=None):
  """
  Returns the logger.
  If `name` is specified, child logger is returned.
  Otherwise the default jubakit logger is returned.

  This is mainly expected for internal uses but users can get logger
  to print their own logs.
  """
  if name is None:
    return _logger
  return _logger.getChild(name)

@@ -319,16 +319,70 @@
 age)s'%0A%0A
+# jubakit root logger name.%0A_LOGGER_NAME = 'jubakit'%0A%0A
 # Define
@@ -522,25 +522,28 @@
 tLogger(
-'jubakit'
+_LOGGER_NAME
 )%0A_logge
@@ -1226,34 +1226,148 @@
 r%0A  
-return _logger.getChild(name
+elif hasattr(_logger, 'getChild'):%0A    return _logger.getChild(name)%0A  else:%0A    return logging.getLogger('%7B0%7D.%7B1%7D'.format(_LOGGER_NAME, name)
 )%0A

fix get_logger now working on Python 2.6