Skip to content

Commit

Permalink
NO-REF: Update logger to snake case (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevillegas93 authored Nov 15, 2024
1 parent d7b19f1 commit b4ce653
Show file tree
Hide file tree
Showing 61 changed files with 125 additions and 125 deletions.
4 changes: 2 additions & 2 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from sqlalchemy.exc import DataError
from waitress import serve

from logger import createLog
from logger import create_log
from .blueprints import (
search, work, info, edition, utils, link, opds, collection, citation, fulfill
)
from .utils import APIUtils

logger = createLog(__name__)
logger = create_log(__name__)


class FlaskAPI:
Expand Down
4 changes: 2 additions & 2 deletions api/automaticCollectionUtils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


def fetchAutomaticCollectionEditions(dbClient, esClient, collectionId, page: int, perPage: int):
Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbCitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from ..db import DBClient
from ..utils import APIUtils
from ..validation_utils import is_valid_uuid
from logger import createLog
from logger import create_log
from datetime import date

logger = createLog(__name__)
logger = create_log(__name__)

citation = Blueprint('citation', __name__, url_prefix='/citation')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from ..utils import APIUtils
from ..validation_utils import is_valid_uuid
from ..opds2 import Feed, Publication
from logger import createLog
from logger import create_log
from model import Work, Edition
from model.postgres.collection import COLLECTION_EDITIONS

logger = createLog(__name__)
logger = create_log(__name__)

collection = Blueprint('collection', __name__, url_prefix='/collection')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbEdition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from ..db import DBClient
from ..utils import APIUtils
from ..validation_utils import is_valid_numeric_id
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

edition = Blueprint('edition', __name__, url_prefix='/edition')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbFulfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from ..utils import APIUtils
from ..validation_utils import is_valid_numeric_id
from managers import S3Manager
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

fulfill = Blueprint('fulfill', __name__, url_prefix='/fulfill')
response_type = 'fulfill'
Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbInfo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from flask import Blueprint, url_for, redirect

from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

info = Blueprint('info', __name__, url_prefix='/')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from ..db import DBClient
from ..utils import APIUtils
from ..validation_utils import is_valid_numeric_id
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

link = Blueprint('link', __name__, url_prefix='/link')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbOPDS2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from ..opdsUtils import OPDSUtils
from ..utils import APIUtils
from ..opds2 import Feed, Link, Metadata, Navigation, Publication, Facet, Group
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


opds = Blueprint('opds', __name__, url_prefix='/opds')
Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from ..elastic import ElasticClient, ElasticClientError
from ..db import DBClient
from ..utils import APIUtils
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

search = Blueprint('search', __name__, url_prefix='/search')

Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from ..db import DBClient
from ..elastic import ElasticClient
from ..utils import APIUtils
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


utils = Blueprint('utils', __name__, url_prefix='/utils')
Expand Down
4 changes: 2 additions & 2 deletions api/blueprints/drbWork.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from ..db import DBClient
from ..utils import APIUtils
from ..validation_utils import is_valid_uuid
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)

work = Blueprint('work', __name__, url_prefix='/work')

Expand Down
4 changes: 2 additions & 2 deletions api/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import re

from .utils import APIUtils
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class ElasticClient():
Expand Down
4 changes: 2 additions & 2 deletions api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from model import Collection, Edition
import re
from model.postgres.collection import COLLECTION_EDITIONS
from logger import createLog
from logger import create_log
from botocore.exceptions import ClientError
from urllib.parse import urlparse


logger = createLog(__name__)
logger = create_log(__name__)

class APIUtils():
QUERY_TERMS = [
Expand Down
10 changes: 5 additions & 5 deletions logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
}


def createLog(module):
def create_log(module):
logger = logging.getLogger(module)
consoleLog = logging.StreamHandler(stream=sys.stdout)
console_log_handler = logging.StreamHandler(stream=sys.stdout)

logLevel = os.environ.get('LOG_LEVEL', 'warning').lower()

logger.setLevel(levels[logLevel])
consoleLog.setLevel(levels[logLevel])
console_log_handler.setLevel(levels[logLevel])

formatter = NewRelicContextFormatter('%(asctime)s | %(name)s | %(levelname)s: %(message)s') # noqa: E501
consoleLog.setFormatter(formatter)
console_log_handler.setFormatter(formatter)

logger.addHandler(consoleLog)
logger.addHandler(console_log_handler)

return logger
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import inspect

from load_env import load_env_file
from logger import createLog
from logger import create_log

#NEW_RELIC_LICENSE_KEY = Put license key here
#ENVIRONMENT = Put environment here
Expand All @@ -17,7 +17,7 @@
)

def main(args):
logger = createLog(__name__)
logger = create_log(__name__)

environment = args.environment
process = args.process
Expand Down
4 changes: 2 additions & 2 deletions managers/coverFetchers/contentCafeFetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import requests
from requests.exceptions import ReadTimeout

from logger import createLog
from logger import create_log
from managers.coverFetchers.abstractFetcher import AbstractFetcher

logger = createLog(__name__)
logger = create_log(__name__)


class ContentCafeFetcher(AbstractFetcher):
Expand Down
4 changes: 2 additions & 2 deletions managers/coverFetchers/googleBooksFetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import requests
from requests.exceptions import ReadTimeout, HTTPError

from logger import createLog
from logger import create_log
from managers.coverFetchers.abstractFetcher import AbstractFetcher

logger = createLog(__name__)
logger = create_log(__name__)


class GoogleBooksFetcher(AbstractFetcher):
Expand Down
4 changes: 2 additions & 2 deletions managers/coverFetchers/hathiFetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from requests_oauthlib import OAuth1

from managers.coverFetchers.abstractFetcher import AbstractFetcher
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class HathiFetcher(AbstractFetcher):
Expand Down
4 changes: 2 additions & 2 deletions managers/coverFetchers/openLibraryFetcher.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
from requests.exceptions import ReadTimeout, HTTPError

from logger import createLog
from logger import create_log
from managers.coverFetchers.abstractFetcher import AbstractFetcher
from model import OpenLibraryCover

logger = createLog(__name__)
logger = create_log(__name__)


class OpenLibraryFetcher(AbstractFetcher):
Expand Down
4 changes: 2 additions & 2 deletions managers/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from sqlalchemy.exc import OperationalError

from model import Base
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class DBManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/doabParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import re
from requests.exceptions import ConnectionError, InvalidURL, MissingSchema, ReadTimeout

from logger import createLog
from logger import create_log
import managers.parsers as parsers

logger = createLog(__name__)
logger = create_log(__name__)


class DOABLinkManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from elastic_transport import ConnectionTimeout

from model import ESWork
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class ElasticsearchManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/gutenberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import requests
import yaml

from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class GutenbergManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/kMeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.exceptions import ConvergenceWarning

from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class FeatureSelector(BaseEstimator, TransformerMixin):
Expand Down
4 changes: 2 additions & 2 deletions managers/muse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from requests.exceptions import ReadTimeout, ConnectionError, HTTPError

from managers import WebpubManifest
from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class MUSEManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/oclc_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from requests.exceptions import Timeout, ConnectionError
from typing import Optional

from logger import createLog
from logger import create_log


logger = createLog(__name__)
logger = create_log(__name__)


class OCLCAuthManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/oclc_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from requests.exceptions import Timeout, ConnectionError
from typing import Optional

from logger import createLog
from logger import create_log
from managers.oclc_auth import OCLCAuthManager


logger = createLog(__name__)
logger = create_log(__name__)


class OCLCCatalogManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from pika.exceptions import ConnectionWrongStateError, StreamLostError, ChannelClosedByBroker
import os

from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class RabbitMQManager:
Expand Down
4 changes: 2 additions & 2 deletions managers/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import os
from redis import Redis

from logger import createLog
from logger import create_log

logger = createLog(__name__)
logger = create_log(__name__)


class RedisManager:
Expand Down
Loading

0 comments on commit b4ce653

Please sign in to comment.