Preston-Landers / concurrent-log-handler

fork of ConcurrentLogHandler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Member "Terminator" doesn't exist

opened this issue · comments

There is no member terminator.
init.py:294

    if self.terminator:
        stream.write(self.terminator)

A terminator string can be implemented with a formatter.

Hey, thanks for the report. Are you getting a traceback with this at runtime? If so, what is your Python version?

AFAIK, self.terminator is inherited from logging.StreamHandler.

ConcurrentRotatingFileHandler inherits from BaseRotatingHandler -> FileHandler -> StreamHandler, which should define self.terminator.

Python 2.7.13 |Anaconda 4.4.0 (32-bit)| (default, May 11 2017, 14:07:41) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

from logging import getLogger, INFO
from concurrent_log_handler import ConcurrentRotatingFileHandler
import os

log = getLogger()
logfile = os.path.abspath("mylogfile.log")
rotateHandler = ConcurrentRotatingFileHandler(logfile, "a", 512*1024, 5)
log.addHandler(rotateHandler)
log.setLevel(INFO)

log.info("Here is a very exciting log message, just for you")
Traceback (most recent call last):
File "c:\Anaconda2\lib\site-packages\concurrent_log_handler_init_.py", line 276, in emit
self.do_write(msg)
File "c:\Anaconda2\lib\site-packages\concurrent_log_handler_init_.py", line 294, in do_write
if self.terminator:
AttributeError: 'ConcurrentRotatingFileHandler' object has no attribute 'terminator'
Logged from file , line 1

seems to work fine with
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] on win32

Yeah, looks like my latest changes broke Python 2 compatibility there. I should be able to push out a new version today that fixes it.

This project needs a CI solution that runs the test under all supported interpreters. The test itself (stresstest.py) isn't structured like a classic unit test either.

Ok the commit 6cb9443 should fix it. I just pushed version 0.9.9. Hopefully that takes care of the problem. Thanks for the report!

Please reopen this issue if 0.9.9 doesn't fix the problem. Thanks!