from django.conf import settings

class LogViewerService(object):
    def get_logs(self):
        try:
            log_path = settings.LOG_PATH
            with open("%s/console.log" % log_path, 'r') as f:
                try:
                    f.seek(-100000, 2)
                except Exception:
                    pass
                a = [str(i) for i in f.readlines()]
        except Exception as e:
            a = ['']
        return a


log_service = LogViewerService()
