better logging

This commit is contained in:
Christoph J. Scherr 2023-06-03 23:54:11 +02:00
parent dd4f92ca1e
commit 630d150bcc
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
7 changed files with 21 additions and 81 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ db/data
gawa/gawa/__pycache__
gawa/start/__pycache__
gawa/blog/__pycache__
gawa/debug.log
gawa/errors.log

View File

@ -4,49 +4,21 @@
{% block languagecode %}{{ LANGUAGE_CODE }}{% endblock languagecode %}
{% block title %}{% translate "cscherr.de" %} - {% translate "Blog" %}{% endblock title %}
{% block nav %}
{% include 'blog/nav.html' %}
{% include 'blog/nav.html' %}
{% endblock nav %}
{% block headscripts %}
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3.0.0/es5/tex-mml-chtml.js">
</script>
{% endblock headscripts %}
{% block main %}
<div class="container-xl">
<div class="jumbotron text-center">
<h1>{{ post.title }}</h1>
<p>{% translate "Blog" %}</p>
</div>
<div class="row text-center">
<div class="col mx-3 my-5">
<h3>{% translate "Writeups" %}</h3>
<p>
{% blocktranslate %}
Whenever I discover some interesting security thing, I will post a writeup here.
{% endblocktranslate %}
</p>
</div>
<div class="col mx-3 my-5">
<h3>{% translate "Open Source" %}</h3>
{% blocktranslate %}
If something comes up, I may post Linux guides or my thoughts on current processes here.
{% endblocktranslate %}
</div>
<div class="col mx-3 my-5">
<h3>{% translate "Selfhosting" %}</h3>
{% blocktranslate %}
Selfhosting is something that I'm really fond of. There will be guides and thoughts about that too
{% endblocktranslate %}
</div>
<div class="col mx-3 my-5">
<h3>{% translate "Anything Really" %}</h3>
{% blocktranslate %}
This is my personal Blog after all, I will put here whatever I want and you can't stop me.
{% endblocktranslate %}
</div>
</div>
<div class="container text-center">
test
<a href="{% url 'blog:post' "test" "test" %}">sus</a>
</div>
<div class="container text-center jumbotron my-3">
<h1 class="my-4">{% translate "Looking for anything specific?" %}</h1>
{% include 'main_search_form.html' %}
$$x=\frac{-b+\sqrt{b^2-4ac}}{2a}$$
</div>
{% include 'blog/featured.html' %}
</div>

View File

@ -34,12 +34,14 @@ class Post(DetailView):
category__slug=self.kwargs['category'], # first slug is category
slug=self.kwargs['slug'] # second slug is article itself
)
logger.critical("hello world")
logger.debug(obj)
match get_language():
case 'de':
logger.debug("returning blogpost for de")
obj['title'] = obj['title_de']
case 'en':
logger.debug("returning blogpost for en")
obj['title'] = obj['title_en']
case _:

View File

@ -1,26 +0,0 @@
[TIME[2023-06-03 21:49:51,872] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[7] THREAD[140464426821440] MESSAGE[Watching for file changes with StatReloader]
[TIME[2023-06-03 21:58:35,767] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[7] THREAD[140464426821440] MESSAGE[/app/gawa/settings.py changed, reloading.]
[TIME[2023-06-03 21:58:36,728] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[9] THREAD[140232828950336] MESSAGE[Watching for file changes with StatReloader]
[TIME[2023-06-03 21:58:36,728] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[9] THREAD[140232828950336] MESSAGE[Watching for file changes with StatReloader]
[TIME[2023-06-03 21:59:17,277] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[9] THREAD[140232828950336] MESSAGE[/app/gawa/settings.py changed, reloading.]
[TIME[2023-06-03 21:59:17,277] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[9] THREAD[140232828950336] MESSAGE[/app/gawa/settings.py changed, reloading.]
[TIME[2023-06-03 21:59:18,370] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[11] THREAD[140632004777792] MESSAGE[Watching for file changes with StatReloader]
[TIME[2023-06-03 21:59:18,370] LEVEL[INFO] MODULE[autoreload] NAME[django.utils.autoreload] PID[11] THREAD[140632004777792] MESSAGE[Watching for file changes with StatReloader]
[TIME[2023-06-03 21:59:26,361] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:26,361] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:26,363] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /ensd/blog/test/test HTTP/1.1" 404 2230]
[TIME[2023-06-03 21:59:26,592] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:26,592] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:26,593] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /favicon.ico HTTP/1.1" 404 2206]
[TIME[2023-06-03 21:59:58,471] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:58,471] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:58,474] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /ensd/blog/test/test HTTP/1.1" 404 2230]
[TIME[2023-06-03 21:59:58,903] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:58,903] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:58,907] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /favicon.ico HTTP/1.1" 404 2206]
[TIME[2023-06-03 22:00:28,959] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 22:00:28,959] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 22:00:28,960] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /ensd/blog/test/test HTTP/1.1" 404 2230]
[TIME[2023-06-03 22:00:29,473] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 22:00:29,473] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 22:00:29,474] LEVEL[WARNING] MODULE[basehttp] NAME[django.server] PID[11] THREAD[140631958742784] MESSAGE["GET /favicon.ico HTTP/1.1" 404 2206]

View File

@ -1,12 +0,0 @@
[TIME[2023-06-03 21:59:26,361] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:26,361] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:26,592] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:26,592] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:58,471] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:58,471] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 21:59:58,903] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 21:59:58,903] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 22:00:28,959] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 22:00:28,959] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /ensd/blog/test/test]
[TIME[2023-06-03 22:00:29,473] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]
[TIME[2023-06-03 22:00:29,473] LEVEL[WARNING] MODULE[log] NAME[django.request] PID[11] THREAD[140631958742784] MESSAGE[Not Found: /favicon.ico]

View File

@ -186,21 +186,21 @@ LOGGING = {
"formatters": {
"django.server": {
"()": "django.utils.log.ServerFormatter",
"format": "[{server_time}] {message}",
'format': '[{levelname}][{name}][{server_time}] "{message}"',
"style": "{",
},
'verbose': {
'format': '[TIME[{asctime}] LEVEL[{levelname}] MODULE[{module}] NAME[{name}] PID[{process:d}] THREAD[{thread:d}] MESSAGE[{message}]',
'format': '[{asctime}][{levelname}][{name}] "{message}"',
'style': '{',
},
'mail': {
'level': 'DEBUG',
'format': 'TIME[{asctime}] LEVEL[{levelname}] MODULE[{module}] NAME[{name}] PID[{process:d}] THREAD[{thread:d}]\nMESSAGE[{message}]',
'format': '[{asctime}][{levelname}][{name}]\n"{message}"',
'style': '{',
},
'simple': {
'level': 'DEBUG',
'format': '{levelname} {message}',
'format': '[{levelname}][{name}] "{message}"',
'style': '{',
},
'fancym': {
@ -216,7 +216,7 @@ LOGGING = {
},
'fancy': {
'()': 'colorlog.ColoredFormatter',
'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s][%(message)s]',
'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] "%(message)s"',
'log_colors': {
'DEBUG': 'cyan',
'INFO': 'green',
@ -227,7 +227,7 @@ LOGGING = {
},
'fancy_internal': {
'()': 'colorlog.ColoredFormatter',
'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s][%(message)s]',
'format': '%(log_color)s[%(asctime)s][%(levelname)s][%(name)s] "%(message)s"',
'log_colors': {
'DEBUG': 'thin_cyan',
'INFO': 'thin_green',
@ -242,7 +242,7 @@ LOGGING = {
"level": "INFO",
"filters": ["require_debug_true"],
"class": "logging.StreamHandler",
"formatter": "fancym",
"formatter": "fancy",
},
"django.server": {
"level": "INFO",

View File

@ -18,6 +18,8 @@
}
setTheme(localStorage.getItem('theme'));
</script>
{% block headscripts %}
{% endblock headscripts %}
</head>
<body>
{% block nav %}