log param

master
JoYo 2022-01-05 19:24:26 -05:00
parent 205025e7ba
commit e496d7d52b
2 changed files with 27 additions and 11 deletions

View File

@ -63,7 +63,7 @@ To schedule a periodic background run of `eso-banana`, open Powershell as a user
```powershell
$Command = (Get-Command "eso-banana-script.exe").Source
$Action = New-ScheduledTaskAction -Execute $Command -Argument "--verbose"
$Action = New-ScheduledTaskAction -Execute $Command -Argument "--log"
$Trigger = New-ScheduledTaskTrigger -Daily -At 11am
$Settings = New-ScheduledTaskSettingsSet -RunOnlyIfNetworkAvailable -StartWhenAvailable -RunOnlyIfIdle
Register-ScheduledTask -TaskName "eso-banana" -Action $Action -Trigger $Trigger -Settings $Settings -Description "Elder Scrolls Online addon manager and a Tamriel Trade Centre price table updater."
@ -113,7 +113,7 @@ crontab -e
Add the following line to your `crontab`.
```
0 11 * * * eso-banana-script --verbose
0 11 * * * eso-banana-script --log
```
# Linux Unschedule
@ -122,5 +122,5 @@ Only run the following command if you wish to remove scheduled run of `eso-banan
To remove the schedule, delete the following line from your `crontab -e`.
```
0 11 * * * eso-banana-script --verbose
0 11 * * * eso-banana-script --log
```

View File

@ -14,6 +14,7 @@ def periodical_script():
description="Visit https://www.esoui.com/ to search for addons and their dependencies URLs. Edit addons.yaml in the ESO live path and add the URL for each addon for installation. "
)
parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
parser.add_argument("-l", "--log")
parser.add_argument("-p", "--eso_live_path")
args = parser.parse_args()
@ -30,15 +31,22 @@ def periodical_script():
)
if args.verbose:
level = logging.DEBUG
format = "%(asctime)s %(filename)s:%(lineno)d %(message)s"
else:
level = logging.INFO
format = "%(message)s"
if args.log:
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
level=level,
format=format,
filename=args.eso_live_path.joinpath("banana.log"),
)
else:
logging.basicConfig(
level=logging.INFO,
format="%(message)s",
level=level,
format=format,
)
logging.info(args)
@ -77,6 +85,7 @@ def periodical_script():
def ttc():
parser = ArgumentParser(description="Tamriel Trade Centre price table updater.")
parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
parser.add_argument("-l", "--log")
parser.add_argument("-p", "--eso_live_path")
args = parser.parse_args()
@ -93,15 +102,22 @@ def ttc():
)
if args.verbose:
level = logging.DEBUG
format = "%(asctime)s %(filename)s:%(lineno)d %(message)s"
else:
level = logging.INFO
format = "%(message)s"
if args.log:
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
level=level,
format=format,
filename=args.eso_live_path.joinpath("banana.log"),
)
else:
logging.basicConfig(
level=logging.INFO,
format="%(message)s",
level=level,
format=format,
)
logging.info(args)