# Path: duct/logs/follower.py
# class LogFollower(object):
#     def __init__(self, logfile, parser=None, tmp_path="/var/lib/duct/",
#                  history=False):
#     def cleanStore(self):
#     def storeLast(self):
#     def readLast(self):
#     def get_fn(self, fn, max_lines=None):
#     def get(self, max_lines=None):
# 
# Path: duct/logs/parsers.py
# class ApacheLogParserError(Exception):
# class ApacheLogParser(object):
#     def __init__(self, fmt):
#     def _parse_date(self, date):
#     def alias(self, field):
#     def _parse_format(self, fmt):
#     def parse(self, line):
#     def pattern(self):
#     def names(self):


from twisted.trial import unittest
from duct.logs import follower, parsers
import datetime
import os

        self.assertEqual(r[0], 'foo2')
        self.assertEqual(r[1], 'bar2')

        # Go backwards
        log = open('test.log', 'wt')
        log.write('foo3\n')
        log.close()

        r = f.get()

        self.assertEqual(r[0], 'foo3')

        os.unlink('test.log')
        os.unlink('testold.log')

    def test_apache_parser(self):
        log = parsers.ApacheLogParser('combined')

        line = '192.168.0.102 - - [16/Jan/2015:11:11:45 +0200] "GET / HTTP/1.1" 200 709 "-" "My browser"'

        want = {
            'status': 200,
            'request': 'GET / HTTP/1.1',
            'bytes': 709,
            'user-agent': 'My browser',
            'client': '192.168.0.102',
            'time': datetime.datetime(2015, 1, 16, 11, 11, 45),
            'referer': None,
            'logname': None,

# Path: duct/logs/follower.py
# class LogFollower(object):
#     def __init__(self, logfile, parser=None, tmp_path="/var/lib/duct/",
#                  history=False):
#     def cleanStore(self):
#     def storeLast(self):
#     def readLast(self):
#     def get_fn(self, fn, max_lines=None):
#     def get(self, max_lines=None):
# 
# Path: duct/logs/parsers.py
# class ApacheLogParserError(Exception):
# class ApacheLogParser(object):
#     def __init__(self, fmt):
#     def _parse_date(self, date):
#     def alias(self, field):
#     def _parse_format(self, fmt):
#     def parse(self, line):
#     def pattern(self):
#     def names(self):


# Path: duct/tests/test_logs.py
from twisted.trial import unittest
from duct.logs import follower, parsers
import datetime
import os


        self.assertEqual(r[0], 'foo2')
        self.assertEqual(r[1], 'bar2')

        # Go backwards
        log = open('test.log', 'wt')
        log.write('foo3\n')
        log.close()

        r = f.get()

        self.assertEqual(r[0], 'foo3')

        os.unlink('test.log')
        os.unlink('testold.log')

    def test_apache_parser(self):
        log = parsers.ApacheLogParser('combined')

        line = '192.168.0.102 - - [16/Jan/2015:11:11:45 +0200] "GET / HTTP/1.1" 200 709 "-" "My browser"'

        want = {
            'status': 200,
            'request': 'GET / HTTP/1.1',
            'bytes': 709,
            'user-agent': 'My browser',
            'client': '192.168.0.102',
            'time': datetime.datetime(2015, 1, 16, 11, 11, 45),
            'referer': None,
            'logname': None,

            'user': None,