diff options
| author | 2019-11-14 13:31:12 +0000 | |
|---|---|---|
| committer | 2019-11-14 13:31:12 +0000 | |
| commit | 301e86190e30c80748c9efc3db576e30589db6b1 (patch) | |
| tree | a40c4fb5402a4c01246d4b9c667196a476b7051d /bitbotd | |
| parent | allow channels to be excluded from print_activity.py (diff) | |
| signature | ||
move default log location to ~/.bitbot/logs/
Diffstat (limited to 'bitbotd')
| -rwxr-xr-x | bitbotd | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -32,8 +32,7 @@ arg_parser.add_argument("--database", "-d", help="Location of the sqlite3 database file") arg_parser.add_argument("--log-dir", "-l", - help="Location of the log directory", - default=os.path.join(directory, "logs")) + help="Location of the log directory") arg_parser.add_argument("--add-server", "-a", help="Add a new server", action="store_true") @@ -60,25 +59,31 @@ if args.version: print("BitBot %s" % IRCBot.VERSION) sys.exit(0) +if not os.path.isdir(args.data_dir): + os.mkdir(args.data_dir) + database_location = None lock_location = None sock_locaiton = None +log_directory = None if not args.database == None: database_location = args.database lock_location = "%s.lock" % args.database sock_location = "%s.sock" % args.database else: - if not os.path.isdir(args.data_dir): - os.mkdir(args.data_dir) database_location = os.path.join(args.data_dir, "bot.db") lock_location = os.path.join(args.data_dir, "bot.lock") sock_location = os.path.join(args.data_dir, "bot.sock") +log_directory = args.log_dir or os.path.join(args.data_dir, "logs") +if not os.path.isdir(log_directory): + os.mkdir(log_directory) + log_level = args.log_level if not log_level: log_level = "debug" if args.verbose else "warn" -log = Logging.Log(not args.no_logging, log_level, args.log_dir) +log = Logging.Log(not args.no_logging, log_level, log_directory) log.info("Starting BitBot %s (Python v%s, db %s)", [IRCBot.VERSION, platform.python_version(), database_location]) |
