1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/data/archivedlogs.py
Kenny Lee Sin Cheong 5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00

35 lines
976 B
Python

import logging
from data.userfiles import DelegateUserfiles
JSON_MIMETYPE = "application/json"
logger = logging.getLogger(__name__)
class LogArchive(object):
def __init__(self, app=None, distributed_storage=None):
self.app = app
if app is not None:
self.state = self.init_app(app, distributed_storage)
else:
self.state = None
def init_app(self, app, distributed_storage):
location = app.config.get("LOG_ARCHIVE_LOCATION")
path = app.config.get("LOG_ARCHIVE_PATH", None)
handler_name = "web.logarchive"
log_archive = DelegateUserfiles(
app, distributed_storage, location, path, handler_name=handler_name
)
# register extension with app
app.extensions = getattr(app, "extensions", {})
app.extensions["log_archive"] = log_archive
return log_archive
def __getattr__(self, name):
return getattr(self.state, name, None)