events: improve logging for geoip
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
01fc63fc98
commit
14f2522c3e
|
@ -1,11 +1,13 @@
|
|||
"""events GeoIP Reader"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from geoip2.database import Reader
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
from authentik.lib.config import CONFIG
|
||||
|
||||
LOGGER = get_logger()
|
||||
|
||||
|
||||
def get_geoip_reader() -> Optional[Reader]:
|
||||
"""Get GeoIP Reader, if configured, otherwise none"""
|
||||
|
@ -13,7 +15,9 @@ def get_geoip_reader() -> Optional[Reader]:
|
|||
if path == "" or not path:
|
||||
return None
|
||||
try:
|
||||
return Reader(path)
|
||||
reader = Reader(path)
|
||||
LOGGER.info("Enabled GeoIP support")
|
||||
return reader
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
|
|
@ -156,8 +156,8 @@ class Event(models.Model):
|
|||
}
|
||||
if response.city.name:
|
||||
self.context["geo"]["city"] = response.city.name
|
||||
except GeoIP2Error:
|
||||
pass
|
||||
except GeoIP2Error as exc:
|
||||
LOGGER.warning("Failed to add geoIP Data to event", exc=exc)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self._state.adding:
|
||||
|
|
|
@ -46,7 +46,6 @@ export class RouterOutlet extends LitElement {
|
|||
updated(): void {
|
||||
if (!this.shadowRoot) return;
|
||||
Array.from(this.shadowRoot?.children).forEach((el) => {
|
||||
console.log("pageTitle" in el);
|
||||
if ("pageTitle" in el) {
|
||||
const title = (el as Page).pageTitle();
|
||||
document.title = `${title} - ${TITLE_SUFFIX}`;
|
||||
|
|
Reference in New Issue