Skip to content

Commit

Permalink
Added parse_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cemsbr committed Sep 6, 2016
1 parent fe8a0c0 commit 845c022
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sparklogstats/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Main classes for the user."""
from .logparser import LogParser


__all__ = ('LogParser',)
5 changes: 5 additions & 0 deletions sparklogstats/logparser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
from json import loads


Expand All @@ -9,6 +10,10 @@ def __init__(self):
def _reset(self):
self.app = Application()

def parse_folder(self, folder):
logs = sorted(glob.glob(folder + '/app-*'))
return (self.parse_file(log) for log in logs)

def parse_file(self, filename):
self._reset()
with open(filename) as file:
Expand Down

0 comments on commit 845c022

Please sign in to comment.