# Django LogUi
> Sometimes I use this in different projects, so I decided to put it on pypi
## Installation
```bash
pip install django-logui
```
## Settings
* ### Add the application to the project.
```python
INSTALLED_APPS = [
#...
'adjango',
'logui',
]
```
* ### In `settings.py` set the params
```python
# logui
from os.path import join
from logui.classes.logger import LoggingBuilder, Logger
LOGUI_LOGS_DIR = join(BASE_DIR, 'logs')
LOGUI_REQUEST_RESPONSE_LOGGER_NAME = 'global'
LOGUI_URL_PREFIX = 'logui/'
LOGUI_CONTROLLERS_SETTINGS = {
'auth_required': True,
'log_name': False,
'not_auth_redirect': f'/admin/login/?next=/{LOGUI_URL_PREFIX}'
}
LOGGING = LoggingBuilder(
format='{levelname} {asctime}: {message}',
datefmt='%d-%m %H:%M:%S',
loggers=(
Logger(name='tbank', level='DEBUG', include_in=['commerce']),
Logger(name='order', level='DEBUG', include_in=[]),
Logger(name='email', level='DEBUG', include_in=[]),
Logger(name='social_auth', level='DEBUG', include_in=[]),
Logger(name='consultation', level='DEBUG', include_in=[]),
Logger(name='commerce', level='DEBUG', include_in=['tbank']),
Logger(name='global', level='DEBUG', include_in=[
'tbank',
'order',
'email',
'social_auth',
'consultation'
'commerce'
]),
)
).build()
LoggingBuilder.check_loggers(LOGGING)
```
```python
# adjango
LOGIN_URL = '/login/'
ADJANGO_BACKENDS_APPS = BASE_DIR / 'apps'
ADJANGO_FRONTEND_APPS = BASE_DIR.parent / 'frontend' / 'src' / 'apps'
ADJANGO_APPS_PREPATH = 'apps.' # if apps in BASE_DIR/apps/app1,app2...
# ADJANGO_APPS_PREPATH = None # if in BASE_DIR/app1,app2...
ADJANGO_EXCEPTION_REPORT_EMAIL = ('ivanhvalevskey@gmail.com',)
# Template for sending a email report on an uncaught error.
# Вы можете его переопределить он принимает лишь context={'traceback': 'str'}
ADJANGO_EXCEPTION_REPORT_TEMPLATE = 'logui/error_report.html'
# adjango использует send_emails для отправки писем синхронно.
ADJANGO_USE_CELERY_MAIL_REPORT = False # Использовать ли celery для отправки писем
ADJANGO_CELERY_SEND_MAIL_TASK = send_mail_task_function # callable task
ADJANGO_LOGGER_NAME = 'global'
ADJANGO_EMAIL_LOGGER_NAME = 'email'
```
#### Read more about [adjango](https://github.com/Artasov/adjango)
* ### Add routes
Only `is_staff` have access.
```python
from django.urls import path, include
# Not use django.conf.settings
from tests.project.project.settings import LOGUI_URL_PREFIX
urlpatterns = [
...
path(LOGUI_URL_PREFIX, include('logui.routes.views')),
]
```
* ### Open https://localhost:8000/logui/
`https:`//`localhost:8000`/`settings.LOGUI_URL_PREFIX`
Raw data
{
"_id": null,
"home_page": "https://github.com/Artasov/adjango",
"name": "django-logui",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "django-logui django utils funcs features logs logging logger",
"author": "xlartas",
"author_email": "ivanhvalevskey@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d6/e9/4881aa2f31b373cd63eece64c74a6c3fd5a39ff2525db9f630fcdbcdc1dc/django_logui-0.0.8.tar.gz",
"platform": null,
"description": "# Django LogUi \r\n\r\n> Sometimes I use this in different projects, so I decided to put it on pypi\r\n\r\n## Installation\r\n```bash\r\npip install django-logui\r\n```\r\n\r\n## Settings\r\n\r\n* ### Add the application to the project.\r\n ```python\r\n INSTALLED_APPS = [\r\n #...\r\n 'adjango',\r\n 'logui',\r\n ]\r\n ```\r\n* ### In `settings.py` set the params\r\n ```python\r\n # logui\r\n from os.path import join\r\n from logui.classes.logger import LoggingBuilder, Logger\r\n \r\n LOGUI_LOGS_DIR = join(BASE_DIR, 'logs')\r\n LOGUI_REQUEST_RESPONSE_LOGGER_NAME = 'global'\r\n LOGUI_URL_PREFIX = 'logui/'\r\n LOGUI_CONTROLLERS_SETTINGS = {\r\n 'auth_required': True,\r\n 'log_name': False,\r\n 'not_auth_redirect': f'/admin/login/?next=/{LOGUI_URL_PREFIX}'\r\n }\r\n LOGGING = LoggingBuilder(\r\n format='{levelname} {asctime}: {message}',\r\n datefmt='%d-%m %H:%M:%S',\r\n loggers=(\r\n Logger(name='tbank', level='DEBUG', include_in=['commerce']),\r\n Logger(name='order', level='DEBUG', include_in=[]),\r\n Logger(name='email', level='DEBUG', include_in=[]),\r\n Logger(name='social_auth', level='DEBUG', include_in=[]),\r\n Logger(name='consultation', level='DEBUG', include_in=[]),\r\n Logger(name='commerce', level='DEBUG', include_in=['tbank']),\r\n Logger(name='global', level='DEBUG', include_in=[\r\n 'tbank',\r\n 'order',\r\n 'email',\r\n 'social_auth',\r\n 'consultation'\r\n 'commerce'\r\n ]),\r\n )\r\n ).build()\r\n LoggingBuilder.check_loggers(LOGGING)\r\n ```\r\n ```python\r\n # adjango\r\n LOGIN_URL = '/login/'\r\n ADJANGO_BACKENDS_APPS = BASE_DIR / 'apps'\r\n ADJANGO_FRONTEND_APPS = BASE_DIR.parent / 'frontend' / 'src' / 'apps'\r\n ADJANGO_APPS_PREPATH = 'apps.' # if apps in BASE_DIR/apps/app1,app2...\r\n # ADJANGO_APPS_PREPATH = None # if in BASE_DIR/app1,app2...\r\n ADJANGO_EXCEPTION_REPORT_EMAIL = ('ivanhvalevskey@gmail.com',)\r\n # Template for sending a email report on an uncaught error.\r\n # \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043b\u0438\u0448\u044c context={'traceback': 'str'}\r\n ADJANGO_EXCEPTION_REPORT_TEMPLATE = 'logui/error_report.html'\r\n \r\n # adjango \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 send_emails \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.\r\n ADJANGO_USE_CELERY_MAIL_REPORT = False # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 celery \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u0435\u043c\r\n ADJANGO_CELERY_SEND_MAIL_TASK = send_mail_task_function # callable task\r\n ADJANGO_LOGGER_NAME = 'global'\r\n ADJANGO_EMAIL_LOGGER_NAME = 'email'\r\n ```\r\n #### Read more about [adjango](https://github.com/Artasov/adjango)\r\n* ### Add routes\r\n\r\n Only `is_staff` have access.\r\n ```python\r\n from django.urls import path, include\r\n # Not use django.conf.settings\r\n from tests.project.project.settings import LOGUI_URL_PREFIX\r\n\r\n urlpatterns = [\r\n ...\r\n path(LOGUI_URL_PREFIX, include('logui.routes.views')),\r\n ]\r\n ```\r\n* ### Open https://localhost:8000/logui/\r\n `https:`//`localhost:8000`/`settings.LOGUI_URL_PREFIX`\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Flexible, fast and productive logging for Django with UI",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/Artasov/adjango",
"Source": "https://github.com/Artasov/django-logui",
"Tracker": "https://github.com/Artasov/django-logui/issues"
},
"split_keywords": [
"django-logui",
"django",
"utils",
"funcs",
"features",
"logs",
"logging",
"logger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a953bdf8634b48388df038468551c777dbb5cf13edae76be7748d83fe1451fe6",
"md5": "af71230e38fc085f99e469e1befc6dcf",
"sha256": "80aad8241a28f86b797606ab4b8814e33e2747632be03a0a8054e51dcbebe4bc"
},
"downloads": -1,
"filename": "django_logui-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af71230e38fc085f99e469e1befc6dcf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 95277,
"upload_time": "2024-10-11T15:37:04",
"upload_time_iso_8601": "2024-10-11T15:37:04.229190Z",
"url": "https://files.pythonhosted.org/packages/a9/53/bdf8634b48388df038468551c777dbb5cf13edae76be7748d83fe1451fe6/django_logui-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d6e94881aa2f31b373cd63eece64c74a6c3fd5a39ff2525db9f630fcdbcdc1dc",
"md5": "925780c728d7a81da6bfb4b1f6847d33",
"sha256": "3ddeb60dab9926b5374ca4c561121cba141dd8d6639b12c4655b005a3dc0afd1"
},
"downloads": -1,
"filename": "django_logui-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "925780c728d7a81da6bfb4b1f6847d33",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 92918,
"upload_time": "2024-10-11T15:37:05",
"upload_time_iso_8601": "2024-10-11T15:37:05.690530Z",
"url": "https://files.pythonhosted.org/packages/d6/e9/4881aa2f31b373cd63eece64c74a6c3fd5a39ff2525db9f630fcdbcdc1dc/django_logui-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-11 15:37:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Artasov",
"github_project": "adjango",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "django-logui"
}