Skip to content

Commit 3f5c886

Browse files
Merge pull request #120 from MEHRSHAD-MIRSHEKARY/update/docs
📚 Update/docs
2 parents 4a415b4 + 12b0823 commit 3f5c886

File tree

6 files changed

+142
-3
lines changed

6 files changed

+142
-3
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,64 @@ Running the command when the log directory exceeds the size limit will trigger a
649649
- An email will be sent to `ADMIN_EMAIL` configured in Django settings.
650650
651651
652+
## LogiBoard Integration
653+
654+
The `LogiBoard` in the `django_logging` package provides an interface for uploading, extracting, and exploring log files that have been zipped and shared via email. This allows for easier log management.
655+
656+
> **Note: Superuser Access Only**
657+
>
658+
> Only superusers have access to the LogiBoard URL. If accessed by a non-superuser, they will get Access Denied page made by Lazarus.
659+
660+
### Setup Instructions
661+
662+
1. **Add to URLs**:
663+
Include the following in your URL configuration to enable access to LogiBoard:
664+
665+
```python
666+
from django.urls import path, include
667+
668+
669+
urlpatterns = [
670+
# ...
671+
path('django-logging/', include('django_logging.urls')),
672+
# ...
673+
]
674+
```
675+
LogiBoard will be accessible at the following link in your project after setting it up:
676+
``/django-logging/log-iboard/``
677+
678+
2. **Static Files**:
679+
Run the following command to collect and prepare the static files necessary for LogiBoard's interface:
680+
681+
```shell
682+
python manage.py collectstatic
683+
```
684+
The `collectstatic` command is required to gather and serve static assets (such as JavaScript, CSS, and images) used by LogiBoard. This ensures the front-end of the log upload and browsing interface works correctly.
685+
686+
3. **Enable LogiBoard**:
687+
In your settings file, ensure the following setting is added under ``DJANGO_LOGGING``:
688+
689+
```python
690+
DJANGO_LOGGING = {
691+
# ...
692+
"INCLUDE_LOG_iBOARD": True,
693+
# ...
694+
}
695+
```
696+
This setting ensures that LogiBoard is available in your project.
697+
698+
### Using LogiBoard
699+
700+
Logiboard is designed to help administrators easily review log files that have been zipped and sent via email (generated by the ``send_logs`` management command). This is particularly useful for remotely retrieving log files from production systems or shared environments.
701+
702+
- **Access Logiboard**: Go to the link `/django-logging/log-iboard/` in your project to open the LogiBoard interface.
703+
- **Upload ZIP Files**: Click the upload icon or drag and drop ZIP files into the upload area. Only ZIP files are supported for upload.
704+
- **Explore Log Files**: After uploading, Logiboard automatically extracts the log files and displays their structure. You can browse through directories and open log files in supported formats, such as `.log`, `.txt`, `.json`, and `.xml`.
705+
- **Upload New Files**: Once you're done reviewing, click the "Send Another" button to upload and explore more logs.
706+
707+
LogiBoard makes it simple to manage and review logs, ensuring you can quickly access and analyze critical log data.
708+
709+
652710
## Settings
653711
654712
By default, `django_logging` uses a built-in configuration that requires no additional setup. However, you can customize the logging settings by adding the `DJANGO_LOGGING` dictionary configuration to your Django `settings` file.
@@ -715,6 +773,13 @@ Here's a breakdown of the available configuration options:
715773
- **Description**: Enables logging of the initialization message when logging starts.
716774
- **Default**: `True`
717775

776+
`INCLUDE_LOG_iBOARD`
777+
--------------------
778+
779+
- **Type**: ``bool``
780+
- **Description**: Makes LogiBoard url accessible in the project. for setting up the LogiBoard, please refer to the [LogiBoard Integration](#LogiBoard-Integration).
781+
- **Default**: `False`
782+
718783
`LOG_SQL_QUERIES_ENABLE`
719784
------------------------
720785

django_logging/static/LogiBoard/js/scripts.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ let folderTree = {};
44
let interval;
55
let progress = 0;
66
let isStopped = false;
7+
let currentFile = null;
78

89
const validFileTypes = ['application/zip', 'application/x-zip-compressed', 'multipart/x-zip'];
910

@@ -31,6 +32,7 @@ function uploadFile(file) {
3132
folderTree = {};
3233
document.getElementById('file-structure').innerHTML = '';
3334
document.getElementById('file-display').innerHTML = '';
35+
currentFile = file;
3436
startUploadProgress(file);
3537
}
3638

@@ -166,7 +168,7 @@ function toggleUploadState() {
166168
isStopped = !isStopped;
167169
clearInterval(interval);
168170
document.getElementById('stop-icon').src = icons[isStopped ? 'pause' : 'stop'];
169-
if (!isStopped) startUploadProgress();
171+
if (!isStopped && currentFile) startUploadProgress(currentFile);
170172
}
171173

172174
document.getElementById('close-icon').addEventListener('click', resetAll);

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# -- Project information -----------------------------------------------------
1414

1515
project = 'django_logging'
16-
copyright = '2024, django_logging'
17-
author = 'ARYAN NIKNEZHAD, MEHRSHAD-MIRSHEKARY'
16+
copyright = '2024, Lazarus'
17+
author = 'ARYAN-NIKNEZHAD, MEHRSHAD-MIRSHEKARY'
1818

1919
# The full version, including alpha/beta/rc tags
2020
release = '2.0.0'

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The documentation is organized into the following sections:
8282

8383
quick_start
8484
usage
85+
log_iboard
8586
settings
8687
contributing
8788
rules

docs/log_iboard.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
LogiBoard Integration
2+
=====================
3+
4+
The ``LogiBoard`` in the ``django_logging`` package provides an interface for uploading, extracting, and exploring log files that have been zipped and shared via email. This allows for easier log management.
5+
6+
.. note::
7+
8+
**Superuser Access Only**: Only superusers have access to the LogiBoard URL. If accessed by a non-superuser, they will get Access Denied page made by Lazarus.
9+
10+
Setup Instructions
11+
------------------
12+
13+
1. **Add to URLs**:
14+
Include the following in your URL configuration to enable access to LogiBoard:
15+
16+
.. code-block:: python
17+
18+
from django.urls import path, include
19+
20+
21+
urlpatterns = [
22+
# ...
23+
path("django-logging/", include("django_logging.urls")),
24+
# ...
25+
]
26+
27+
LogiBoard will be accessible at the following link in your project after setting it up:
28+
``/django-logging/log-iboard/``
29+
30+
2. **Static Files**:
31+
Run the following command to collect and prepare the static files necessary for LogiBoard's interface:
32+
33+
.. code-block:: bash
34+
35+
python manage.py collectstatic
36+
37+
The `collectstatic` command is required to gather and serve static assets (such as JavaScript, CSS, and images) used by LogiBoard. This ensures the front-end of the log upload and browsing interface works correctly.
38+
39+
3. **Enable LogiBoard**:
40+
In your settings file, ensure the following setting is added under ``DJANGO_LOGGING``:
41+
42+
.. code-block:: python
43+
44+
DJANGO_LOGGING = {
45+
# ...
46+
"INCLUDE_LOG_iBOARD": True,
47+
# ...
48+
}
49+
50+
This setting ensures that LogiBoard is available in your project.
51+
52+
53+
Using LogiBoard
54+
---------------
55+
56+
Logiboard is designed to help administrators easily review log files that have been zipped and sent via email (generated by the ``send_logs`` management command). This is particularly useful for remotely retrieving log files from production systems or shared environments.
57+
58+
- **Access Logiboard**: Go to the link ``/django-logging/log-iboard/`` in your project to open the LogiBoard interface.
59+
- **Upload ZIP Files**: Click the upload icon or drag and drop ZIP files into the upload area. Only ZIP files are supported for upload.
60+
- **Explore Log Files**: After uploading, Logiboard automatically extracts the log files and displays their structure. You can browse through directories and open log files in supported formats, such as ``.log``, ``.txt``, ``.json``, and ``.xml``.
61+
- **Upload New Files**: Once you're done reviewing, click the "Send Another" button to upload and explore more logs.
62+
63+
LogiBoard makes it simple to manage and review logs, ensuring you can quickly access and analyze critical log data.

docs/settings.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Default configuration
1111
DJANGO_LOGGING = {
1212
"AUTO_INITIALIZATION_ENABLE": True,
1313
"INITIALIZATION_MESSAGE_ENABLE": True,
14+
"INCLUDE_LOG_iBOARD": True,
1415
"LOG_SQL_QUERIES_ENABLE": True,
1516
"LOG_FILE_LEVELS": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
1617
"LOG_DIR": "logs",
@@ -65,6 +66,13 @@ Here's a breakdown of the available configuration options:
6566
- **Type**: ``bool``
6667
- **Description**: Enables logging of the initialization message when logging starts. Defaults to ``True``.
6768

69+
``INCLUDE_LOG_iBOARD``
70+
----------------------
71+
72+
- **Type**: ``bool``
73+
- **Description**: Makes LogiBoard url accessible in the project. Defaults to ``False``. for setting up the LogiBoard, please refer to the :doc:`LogiBoard Integration <log_iboard>`.
74+
75+
6876
``LOG_SQL_QUERIES_ENABLE``
6977
--------------------------
7078

0 commit comments

Comments
 (0)