Skip to content

Commit

Permalink
update SEAFILE_LOG_TO_STDOUT (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkywalkerSpace authored Dec 25, 2024
1 parent 4cdc0b9 commit 89a6242
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
8 changes: 2 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ def main(background_tasks_only=False):
logging.error('Failed create tables, error: %s' % e)
raise RuntimeError('Failed create tables, error: %s' % e)
logfile = args.logfile
seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 0)
try:
enable_log_to_stdout = int(seafile_log_to_stdout)
except ValueError:
enable_log_to_stdout = 0
if enable_log_to_stdout:
seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 'false') == 'true'
if seafile_log_to_stdout:
logfile = None
app_logger = LogConfigurator(args.loglevel, logfile)
if is_syslog_enabled(config):
Expand Down
8 changes: 2 additions & 6 deletions repo_metadata/script/update_face_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,10 @@ def update_face_info(face_recognition_manager, session):


def init_logging(args):
seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 0)
try:
enable_log_to_stdout = int(seafile_log_to_stdout)
except ValueError:
enable_log_to_stdout = 0
seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 'false') == 'true'
stream = args.logfile
format = '[%(asctime)s] [%(levelname)s] %(name)s:%(lineno)s %(funcName)s %(message)s'
if enable_log_to_stdout:
if seafile_log_to_stdout:
stream = sys.stdout
format = '[seafevents] [%(asctime)s] [%(levelname)s] %(name)s:%(lineno)s %(funcName)s %(message)s'

Expand Down
8 changes: 2 additions & 6 deletions seasearch/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,10 @@ def init_logging(args):
except:
pass

seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 0)
try:
enable_log_to_stdout = int(seafile_log_to_stdout)
except ValueError:
enable_log_to_stdout = 0
seafile_log_to_stdout = os.getenv('SEAFILE_LOG_TO_STDOUT', 'false') == 'true'
stream = args.logfile
format = '[%(asctime)s] [%(levelname)s] %(name)s:%(lineno)s %(funcName)s %(message)s'
if enable_log_to_stdout:
if seafile_log_to_stdout:
stream = sys.stdout
format = '[seafevents] [%(asctime)s] [%(levelname)s] %(name)s:%(lineno)s %(funcName)s %(message)s'
kw = {
Expand Down

0 comments on commit 89a6242

Please sign in to comment.