Skip to content

Commit

Permalink
Merge pull request #120 from MEHRSHAD-MIRSHEKARY/update/docs
Browse files Browse the repository at this point in the history
📚 Update/docs
  • Loading branch information
ARYAN-NIKNEZHAD authored Oct 11, 2024
2 parents 4a415b4 + 12b0823 commit 3f5c886
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 3 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,64 @@ Running the command when the log directory exceeds the size limit will trigger a
- An email will be sent to `ADMIN_EMAIL` configured in Django settings.
## LogiBoard Integration
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.
> **Note: 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.
### Setup Instructions
1. **Add to URLs**:
Include the following in your URL configuration to enable access to LogiBoard:
```python
from django.urls import path, include
urlpatterns = [
# ...
path('django-logging/', include('django_logging.urls')),
# ...
]
```
LogiBoard will be accessible at the following link in your project after setting it up:
``/django-logging/log-iboard/``
2. **Static Files**:
Run the following command to collect and prepare the static files necessary for LogiBoard's interface:

```shell
python manage.py collectstatic
```
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.

3. **Enable LogiBoard**:
In your settings file, ensure the following setting is added under ``DJANGO_LOGGING``:

```python
DJANGO_LOGGING = {
# ...
"INCLUDE_LOG_iBOARD": True,
# ...
}
```
This setting ensures that LogiBoard is available in your project.

### Using LogiBoard

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.

- **Access Logiboard**: Go to the link `/django-logging/log-iboard/` in your project to open the LogiBoard interface.
- **Upload ZIP Files**: Click the upload icon or drag and drop ZIP files into the upload area. Only ZIP files are supported for upload.
- **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`.
- **Upload New Files**: Once you're done reviewing, click the "Send Another" button to upload and explore more logs.
LogiBoard makes it simple to manage and review logs, ensuring you can quickly access and analyze critical log data.
## Settings
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.
Expand Down Expand Up @@ -715,6 +773,13 @@ Here's a breakdown of the available configuration options:
- **Description**: Enables logging of the initialization message when logging starts.
- **Default**: `True`

`INCLUDE_LOG_iBOARD`
--------------------

- **Type**: ``bool``
- **Description**: Makes LogiBoard url accessible in the project. for setting up the LogiBoard, please refer to the [LogiBoard Integration](#LogiBoard-Integration).
- **Default**: `False`

`LOG_SQL_QUERIES_ENABLE`
------------------------

Expand Down
4 changes: 3 additions & 1 deletion django_logging/static/LogiBoard/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let folderTree = {};
let interval;
let progress = 0;
let isStopped = false;
let currentFile = null;

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

Expand Down Expand Up @@ -31,6 +32,7 @@ function uploadFile(file) {
folderTree = {};
document.getElementById('file-structure').innerHTML = '';
document.getElementById('file-display').innerHTML = '';
currentFile = file;
startUploadProgress(file);
}

Expand Down Expand Up @@ -166,7 +168,7 @@ function toggleUploadState() {
isStopped = !isStopped;
clearInterval(interval);
document.getElementById('stop-icon').src = icons[isStopped ? 'pause' : 'stop'];
if (!isStopped) startUploadProgress();
if (!isStopped && currentFile) startUploadProgress(currentFile);
}

document.getElementById('close-icon').addEventListener('click', resetAll);
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# -- Project information -----------------------------------------------------

project = 'django_logging'
copyright = '2024, django_logging'
author = 'ARYAN NIKNEZHAD, MEHRSHAD-MIRSHEKARY'
copyright = '2024, Lazarus'
author = 'ARYAN-NIKNEZHAD, MEHRSHAD-MIRSHEKARY'

# The full version, including alpha/beta/rc tags
release = '2.0.0'
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ The documentation is organized into the following sections:

quick_start
usage
log_iboard
settings
contributing
rules
Expand Down
63 changes: 63 additions & 0 deletions docs/log_iboard.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
LogiBoard Integration
=====================

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.

.. note::

**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.

Setup Instructions
------------------

1. **Add to URLs**:
Include the following in your URL configuration to enable access to LogiBoard:

.. code-block:: python
from django.urls import path, include
urlpatterns = [
# ...
path("django-logging/", include("django_logging.urls")),
# ...
]
LogiBoard will be accessible at the following link in your project after setting it up:
``/django-logging/log-iboard/``

2. **Static Files**:
Run the following command to collect and prepare the static files necessary for LogiBoard's interface:

.. code-block:: bash
python manage.py collectstatic
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.

3. **Enable LogiBoard**:
In your settings file, ensure the following setting is added under ``DJANGO_LOGGING``:

.. code-block:: python
DJANGO_LOGGING = {
# ...
"INCLUDE_LOG_iBOARD": True,
# ...
}
This setting ensures that LogiBoard is available in your project.


Using LogiBoard
---------------

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.

- **Access Logiboard**: Go to the link ``/django-logging/log-iboard/`` in your project to open the LogiBoard interface.
- **Upload ZIP Files**: Click the upload icon or drag and drop ZIP files into the upload area. Only ZIP files are supported for upload.
- **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``.
- **Upload New Files**: Once you're done reviewing, click the "Send Another" button to upload and explore more logs.

LogiBoard makes it simple to manage and review logs, ensuring you can quickly access and analyze critical log data.
8 changes: 8 additions & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Default configuration
DJANGO_LOGGING = {
"AUTO_INITIALIZATION_ENABLE": True,
"INITIALIZATION_MESSAGE_ENABLE": True,
"INCLUDE_LOG_iBOARD": True,
"LOG_SQL_QUERIES_ENABLE": True,
"LOG_FILE_LEVELS": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
"LOG_DIR": "logs",
Expand Down Expand Up @@ -65,6 +66,13 @@ Here's a breakdown of the available configuration options:
- **Type**: ``bool``
- **Description**: Enables logging of the initialization message when logging starts. Defaults to ``True``.

``INCLUDE_LOG_iBOARD``
----------------------

- **Type**: ``bool``
- **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>`.


``LOG_SQL_QUERIES_ENABLE``
--------------------------

Expand Down

0 comments on commit 3f5c886

Please sign in to comment.