> For the complete documentation index, see [llms.txt](https://devguide.e107.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devguide.e107.org/classes-and-methods/logging.md).

# Logging

{% hint style="danger" %}
**Please note:** This page is under construction and has not been finished yet.
{% endhint %}

## **Introduction**

You can log events to the admin [System Logs](https://userguide.e107.org/administration/tools/system-logs) by using the built in log class.\
\
Use the following to retrieve the alerts class object.&#x20;

```php
$log = e107::getLog();
```

## Logging methods

### add()

| Parameter | Description                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------ |
| name      | Title or name for the log event.                                                                       |
| details   | Details for the log event - can be either a string of text or an array.                                |
| type      | The type of event. ([see table below](/classes-and-methods/logging.md#logging-types))                  |
| code      | Custom reference code for your type of event. It should be short, ALL CAPITALS and not contain spaces. |

```php
$log = e107::getLog();
$log->add(name, details, type, code);

//Example: 
$log->add('My Event Name', $myDetailedData, E_LOG_INFORMATIVE, 'MYCODE');
```

## Logging types

| Type                | Description         |
| ------------------- | ------------------- |
| E\_LOG\_INFORMATIVE | Informational event |
| E\_LOG\_NOTICE      | Notice event        |
| E\_LOG\_WARNING     | Warning event       |
| E\_LOG\_FATAL       | Fatal event         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devguide.e107.org/classes-and-methods/logging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
