mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-23 08:09:48 -05:00
Merge branch 'logging' into qa
This commit is contained in:
commit
25256db003
@ -123,7 +123,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
"""
|
||||
import re, json
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
for behavior in behaviors(behaviors_dir=behaviors_dir):
|
||||
if re.match(behavior["url_regex"], url):
|
||||
@ -139,7 +139,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
logger.info(
|
||||
"rendering template",
|
||||
template=behavior["behavior_js_template"],
|
||||
parameters=json.dumps(parameters),
|
||||
parameters=parameters,
|
||||
url=url,
|
||||
)
|
||||
return script
|
||||
|
@ -268,7 +268,7 @@ class Chrome:
|
||||
if time.time() - self._last_warning > 30:
|
||||
url_logger.warning(
|
||||
"problem accessing url (will keep trying until timeout)",
|
||||
timeout=timeout_sec,
|
||||
timeout_sec=timeout_sec,
|
||||
exc_info=True,
|
||||
)
|
||||
self._last_warning = time.time()
|
||||
|
@ -43,7 +43,7 @@ import rethinkdb as rdb
|
||||
|
||||
r = rdb.RethinkDB()
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
|
||||
def add_common_options(arg_parser, argv=None):
|
||||
@ -137,7 +137,7 @@ def configure_logging(args):
|
||||
structlog.processors.add_log_level,
|
||||
structlog.processors.StackInfoRenderer(),
|
||||
structlog.dev.set_exc_info,
|
||||
structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S", utc=False),
|
||||
structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S", utc=True),
|
||||
structlog.processors.CallsiteParameterAdder(
|
||||
[
|
||||
structlog.processors.CallsiteParameter.FILENAME,
|
||||
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||
import structlog
|
||||
import sys
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
try:
|
||||
import flask
|
||||
|
@ -21,6 +21,8 @@ limitations under the License.
|
||||
import structlog
|
||||
import sys
|
||||
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
try:
|
||||
import warcprox
|
||||
import warcprox.main
|
||||
@ -30,7 +32,7 @@ try:
|
||||
import wsgiref.handlers
|
||||
import brozzler.dashboard
|
||||
except ImportError as e:
|
||||
structlog.get_logger().critical(
|
||||
logger.critical(
|
||||
'%s: %s\n\nYou might need to run "pip install '
|
||||
'brozzler[easy]".\nSee README.rst for more information.',
|
||||
type(e).__name__,
|
||||
@ -310,7 +312,7 @@ class BrozzlerEasyController:
|
||||
state_strs.append(str(th))
|
||||
stack = traceback.format_stack(sys._current_frames()[th.ident])
|
||||
state_strs.append("".join(stack))
|
||||
structlog.get_logger().warning(
|
||||
logger.warning(
|
||||
"dumping state (caught signal)", signal=signum, state="\n".join(state_strs)
|
||||
)
|
||||
|
||||
|
@ -37,7 +37,7 @@ import zlib
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
|
||||
def load_schema():
|
||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
||||
import sys
|
||||
import structlog
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
try:
|
||||
import pywb.apps.cli
|
||||
|
@ -119,7 +119,7 @@ def is_permitted_by_robots(site, url, proxy=None):
|
||||
# reppy has wrapped an exception that we want to bubble up
|
||||
raise brozzler.ProxyError(e)
|
||||
else:
|
||||
structlog.get_logger().warning(
|
||||
structlog.get_logger(logger_name=__name__).warning(
|
||||
"returning true (permitted) after problem fetching " "robots.txt",
|
||||
url=url,
|
||||
exception=e,
|
||||
|
@ -44,7 +44,7 @@ YTDLP_WAIT = 10
|
||||
YTDLP_MAX_REDIRECTS = 5
|
||||
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
|
||||
def should_ytdlp(site, page, page_status):
|
||||
|
@ -36,7 +36,7 @@ import sys
|
||||
import warcprox
|
||||
|
||||
|
||||
logger = structlog.get_logger()
|
||||
logger = structlog.get_logger(logger_name=__name__)
|
||||
|
||||
|
||||
# https://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib
|
||||
|
Loading…
x
Reference in New Issue
Block a user