Set photodb log_level from argv.
This commit is contained in:
parent
de2f1caa42
commit
010c92cb73
3 changed files with 27 additions and 5 deletions
|
@ -3,9 +3,12 @@ import sys
|
||||||
|
|
||||||
from voussoirkit import getpermission
|
from voussoirkit import getpermission
|
||||||
from voussoirkit import pathclass
|
from voussoirkit import pathclass
|
||||||
|
from voussoirkit import vlogging
|
||||||
|
|
||||||
import etiquette
|
import etiquette
|
||||||
|
|
||||||
|
LOG_LEVEL = vlogging.NOTSET
|
||||||
|
|
||||||
class CantFindPhotoDB(Exception):
|
class CantFindPhotoDB(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -24,7 +27,12 @@ def find_photodb():
|
||||||
if path == path.parent:
|
if path == path.parent:
|
||||||
raise CantFindPhotoDB()
|
raise CantFindPhotoDB()
|
||||||
path = path.parent
|
path = path.parent
|
||||||
photodb = etiquette.photodb.PhotoDB(path.with_child('_etiquette'), create=False)
|
|
||||||
|
photodb = etiquette.photodb.PhotoDB(
|
||||||
|
path.with_child('_etiquette'),
|
||||||
|
create=False,
|
||||||
|
log_level=LOG_LEVEL,
|
||||||
|
)
|
||||||
photodbs[path] = photodb
|
photodbs[path] = photodb
|
||||||
return photodb
|
return photodb
|
||||||
|
|
||||||
|
@ -215,6 +223,9 @@ def tag_breplace_argparse(args):
|
||||||
photodb.commit()
|
photodb.commit()
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
global LOG_LEVEL
|
||||||
|
(LOG_LEVEL, argv) = vlogging.get_level_by_argv(argv)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,16 @@ import gevent.pywsgi
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from voussoirkit import pathclass
|
from voussoirkit import pathclass
|
||||||
|
from voussoirkit import vlogging
|
||||||
|
|
||||||
import backend
|
import backend
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
|
|
||||||
site = backend.site
|
site = backend.site
|
||||||
|
|
||||||
HTTPS_DIR = pathclass.Path(__file__).parent.with_child('https')
|
HTTPS_DIR = pathclass.Path(__file__).parent.with_child('https')
|
||||||
|
LOG_LEVEL = vlogging.NOTSET
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
def etiquette_flask_launch(
|
def etiquette_flask_launch(
|
||||||
*,
|
*,
|
||||||
|
@ -52,7 +54,7 @@ def etiquette_flask_launch(
|
||||||
if localhost_only:
|
if localhost_only:
|
||||||
site.localhost_only = True
|
site.localhost_only = True
|
||||||
|
|
||||||
backend.common.init_photodb(create=create)
|
backend.common.init_photodb(create=create, log_level=LOG_LEVEL)
|
||||||
|
|
||||||
message = f'Starting server on port {port}'
|
message = f'Starting server on port {port}'
|
||||||
if use_https:
|
if use_https:
|
||||||
|
@ -73,6 +75,9 @@ def etiquette_flask_launch_argparse(args):
|
||||||
)
|
)
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
global LOG_LEVEL
|
||||||
|
(LOG_LEVEL, argv) = vlogging.get_level_by_argv(argv)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument('port', nargs='?', type=int, default=5000)
|
parser.add_argument('port', nargs='?', type=int, default=5000)
|
||||||
|
|
|
@ -10,9 +10,12 @@ import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from voussoirkit import getpermission
|
from voussoirkit import getpermission
|
||||||
|
from voussoirkit import vlogging
|
||||||
|
|
||||||
import etiquette
|
import etiquette
|
||||||
|
|
||||||
|
LOG_LEVEL = vlogging.NOTSET
|
||||||
|
|
||||||
def easytagger():
|
def easytagger():
|
||||||
while True:
|
while True:
|
||||||
i = input('> ')
|
i = input('> ')
|
||||||
|
@ -35,7 +38,7 @@ def photag(photo_id):
|
||||||
|
|
||||||
def erepl_argparse(args):
|
def erepl_argparse(args):
|
||||||
global P
|
global P
|
||||||
P = etiquette.photodb.PhotoDB(create=args.create)
|
P = etiquette.photodb.PhotoDB(create=args.create, log_level=LOG_LEVEL)
|
||||||
|
|
||||||
if args.exec_statement:
|
if args.exec_statement:
|
||||||
exec(args.exec_statement)
|
exec(args.exec_statement)
|
||||||
|
@ -53,6 +56,9 @@ def erepl_argparse(args):
|
||||||
break
|
break
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
global LOG_LEVEL
|
||||||
|
(LOG_LEVEL, argv) = vlogging.get_level_by_argv(argv)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument('--exec', dest='exec_statement', default=None)
|
parser.add_argument('--exec', dest='exec_statement', default=None)
|
||||||
|
|
Loading…
Reference in a new issue