"""Benchmarks too low logger levels"""
from logbook import Logger, ERROR


log = Logger('Test logger')
log.level = ERROR


def run():
    for x in xrange(500):
        log.warning('this is not handled')

"""Benchmarks too low logger levels"""
from logbook import Logger, StreamHandler, ERROR
from cStringIO import StringIO


log = Logger('Test logger')
log.level = ERROR


def run():
    out = StringIO()
    with StreamHandler(out):
        for x in xrange(500):
            log.warning('this is not handled')

Create a stream handler even though it's not used to have the same overhead on both logbook and logging
Create a stream handler even though it's not used to have the same overhead on both logbook and logging

  """Benchmarks too low logger levels"""
- from logbook import Logger, ERROR
+ from logbook import Logger, StreamHandler, ERROR
+ from cStringIO import StringIO
  
  
  log = Logger('Test logger')
  log.level = ERROR
  
  
  def run():
+     out = StringIO()
+     with StreamHandler(out):
-     for x in xrange(500):
+         for x in xrange(500):
-         log.warning('this is not handled')
+             log.warning('this is not handled')
  
Create a stream handler even though it's not used to have the same overhead on both logbook and logging
## Code Before:
"""Benchmarks too low logger levels"""
from logbook import Logger, ERROR


log = Logger('Test logger')
log.level = ERROR


def run():
    for x in xrange(500):
        log.warning('this is not handled')

## Instruction:
Create a stream handler even though it's not used to have the same overhead on both logbook and logging
## Code After:
"""Benchmarks too low logger levels"""
from logbook import Logger, StreamHandler, ERROR
from cStringIO import StringIO


log = Logger('Test logger')
log.level = ERROR


def run():
    out = StringIO()
    with StreamHandler(out):
        for x in xrange(500):
            log.warning('this is not handled')
