2015-09-08 21:42:56 +02:00
|
|
|
import logging
|
2016-06-04 23:05:14 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
from lbrynet.conf import LOG_FILE_NAME
|
|
|
|
from appdirs import user_data_dir
|
2015-09-08 21:42:56 +02:00
|
|
|
|
2016-06-04 23:05:14 +02:00
|
|
|
if sys.platform != "darwin":
|
|
|
|
log_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
|
|
|
else:
|
|
|
|
log_dir = user_data_dir("LBRY")
|
2015-09-08 21:42:56 +02:00
|
|
|
|
2016-06-04 23:05:14 +02:00
|
|
|
if not os.path.isdir(log_dir):
|
|
|
|
os.mkdir(log_dir)
|
2016-03-22 02:37:15 +01:00
|
|
|
|
2016-06-04 23:05:14 +02:00
|
|
|
LOG_PATH = os.path.join(log_dir, LOG_FILE_NAME)
|
|
|
|
|
|
|
|
if os.path.isfile(LOG_PATH):
|
|
|
|
f = open(LOG_PATH, 'r')
|
|
|
|
PREVIOUS_LOG = len(f.read())
|
|
|
|
f.close()
|
|
|
|
else:
|
|
|
|
PREVIOUS_LOG = 0
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
log.addHandler(logging.FileHandler(filename=LOG_PATH))
|
|
|
|
log.setLevel(logging.ERROR)
|
2016-03-22 02:37:15 +01:00
|
|
|
|
2016-05-30 21:49:25 +02:00
|
|
|
version = (0, 2, 5)
|
2016-03-24 03:02:02 +01:00
|
|
|
__version__ = ".".join([str(x) for x in version])
|