# Plugin Logger

{% hint style="warning" %}
Currently, the `logger` functionality is not available for Model plugins in v3. Using it may cause issues. We will remove this notice once it is available again.
{% endhint %}

We provide plugin developers with a way to communicate to users while the plugin is being run, through log messages.

You will need to use the *PluginLogger* class, documented below:

## ango.plugin\_logger.PluginLogger

### Parameters

* **name**: *str*
* **plugin\_id**: *str*
* **org\_id**: *str*
* **run\_by**: str
* **session**: *str*
* **plugin**: *socketio.ClientNamespace*
* **level**: *logging.NOTSET*

### Functions

The only difference between these functions is the word used at the beginning of the log, between "WARNING, ERROR, DEBUG, and INFO." All four only emit log messages.

* warning(msg, \*args, \*\*kwargs)
* error(msg, \*args, \*\*kwargs)
* debug(msg, \*args, \*\*kwargs)
* info(msg, \*args, \*\*kwargs)

### Code Sample

```python
from imerit_ango.sdk import SDK
from imerit_ango.plugins import MarkdownPlugin, run

HOST = '<YOUR HOST>'
PLUGIN_ID = '<YOUR PLUGIN ID>'
PLUGIN_SECRET = '<YOUR PLUGIN SECRET>'

def sample_callback_function(**data):
    logger = data.get('logger')

    logger.info("Plugin session is started!")
    
    # plugin logic here #
    
    logger.info("Plugin session is ended!")
    
    if response['status'] == 'success':
        return 'All markdown files are uploaded!'
    else:
        logger.warning(response['message'])
        return response['message']


if __name__ == "__main__":
    plugin = MarkdownPlugin(id=PLUGIN_ID,
                            secret=PLUGIN_SECRET,
                            callback=sample_callback_function)

    run(plugin, host=HOST)
```

## How log messages are shown to users

Users can see the log messages you send with the *Logger* class by opening the *Plugin Sessions* dialog and expanding the row for the plugin session where they'd like to see the logs:

<figure><img src="https://3895963154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTcOUG6rfWxqGM0N4db2P%2Fuploads%2FcyG6zy34t9cQMbeqkAj6%2Fimage.png?alt=media&#x26;token=af44ef84-7021-48b7-bc68-52e81b602630" alt="" width="563"><figcaption></figcaption></figure>
