Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Fix str to dict
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Feb 14, 2018
1 parent a0169a6 commit b9bd3cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sherlog/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_session(config):


def convert_to_dict(data):
return eval(data[1:-1].replace('\n', ''))
return eval(data.rstrip()[1:-1].replace('\n', ''))


def get_name(data):
Expand Down Expand Up @@ -56,7 +56,9 @@ def insert_log(line, dbsession):
title = line.split('(')[0]
server_name = get_name(title)
desc = convert_to_dict(line.split(title)[1])
dbsession.add(Log(build_log(server_name, desc)))
log = Log(build_log(server_name, desc))
dbsession.add(log)
dbsession.commit()


def read_log(logfile):
Expand Down

0 comments on commit b9bd3cf

Please sign in to comment.