Skip to content

Commit 0501875

Browse files
authored
Logging (#173)
* Use logging + removed overrided logout method * Logging level is settable through ev's * Logging level is settable through ev's * Updated Changelog * Corrected typo * Shows an info message for log level configuration * Corrected mistake * Use critical * Use stdout * Log command error * Added * Attempted fix * Rollback * Attempted fix * Added ?debug clear * Added color * Update CHANGELOG.md * Create temp/ on start + updated .gitignore * Rename Modmail reference * Use logging instead of print + fixed problem where create was awaited * Created MessagePaginatorSession for better ?debug logs, changed default paginator timeout seconds * Updated docstring for close and debug clear * Log the base `on_error` as well * Log CommandNotFound error * Log CommandNotFound error * Updated CHANGELOG * updated .gitignore
1 parent c629e7b commit 0501875

13 files changed

+557
-128
lines changed

.gitignore

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ __pycache__/
88

99
# Distribution / packaging
1010
.Python
11-
env/
1211
build/
1312
develop-eggs/
1413
dist/
@@ -21,9 +20,12 @@ parts/
2120
sdist/
2221
var/
2322
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
2425
*.egg-info/
2526
.installed.cfg
2627
*.egg
28+
MANIFEST
2729

2830
# PyInstaller
2931
# Usually these files are written by a python script from a template
@@ -38,13 +40,15 @@ pip-delete-this-directory.txt
3840
# Unit test / coverage reports
3941
htmlcov/
4042
.tox/
43+
.nox/
4144
.coverage
4245
.coverage.*
4346
.cache
4447
nosetests.xml
4548
coverage.xml
4649
*.cover
4750
.hypothesis/
51+
.pytest_cache/
4852

4953
# Translations
5054
*.mo
@@ -53,6 +57,7 @@ coverage.xml
5357
# Django stuff:
5458
*.log
5559
local_settings.py
60+
db.sqlite3
5661

5762
# Flask stuff:
5863
instance/
@@ -70,6 +75,10 @@ target/
7075
# Jupyter Notebook
7176
.ipynb_checkpoints
7277

78+
# IPython
79+
profile_default/
80+
ipython_config.py
81+
7382
# pyenv
7483
.python-version
7584

@@ -79,13 +88,14 @@ celerybeat-schedule
7988
# SageMath parsed files
8089
*.sage.py
8190

82-
# dotenv
91+
# Environments
8392
.env
84-
85-
# virtualenv
8693
.venv
94+
env/
8795
venv/
8896
ENV/
97+
env.bak/
98+
venv.bak/
8999

90100
# Spyder project settings
91101
.spyderproject
@@ -99,10 +109,13 @@ ENV/
99109

100110
# mypy
101111
.mypy_cache/
102-
*.json
103-
!app.json
112+
.dmypy.json
113+
dmypy.json
114+
115+
# Pyre type checker
116+
.pyre/
104117

105-
# Pycharm
118+
# PyCharm
106119
.idea/
107120

108121
# MacOS
@@ -114,3 +127,4 @@ ENV/
114127
# Modmail
115128
config.json
116129
plugins/
130+
temp/

CHANGELOG.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
# [Unreleased]
88

9+
### Added
10+
- You will no longer need to view your bot debug logs from Heroku. `debug` will show you the you the recent logs within 24h through a series of embeds.
11+
- If you don't mind your data (may or may not be limited to: user ID, guild ID, bot name) be on the internet, `debug hastebin` will upload a formatted logs file to https://hastebin.com.
12+
- `debug clear` will clear the locally cached logs.
13+
- Local logs are automatically cleared at least once every 27h.
14+
915
### Fixed
16+
- Will no longer show `Unclosed client session` and `Task was destroyed but it is pending!` when the bot terminates.
1017
- `thread.create` is now synchronous so that the first message sent can be queued to be sent as soon as a thread is created.
1118
- This fixes a problem where if multiple messages are sent in quick succession, the first message sent (which triggers the thread creation) is not sent in order.
12-
1319
- Trying to reply to someone who has DMs disabled or has blocked the bot is now handled and the bot will send a message saying so.
1420

21+
### Changed
22+
- `print` is replaced by logging.
23+
- New environment variable introduced: `LOG_LEVEL`.
24+
- This influences the amount of messages received in Heroku logs.
25+
- Possible options, from least to most severe, are: `INFO`, `DEBUG`, `WARNING`, `ERROR`, `CRITICAL`.
26+
- In most cases, you can ignore this change.
27+
- `on_error` and `CommandNotFound` are now logged.
28+
1529
# v2.13.4
1630

1731
### Changed
@@ -20,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2034
# v2.13.3
2135

2236
### Fixed
23-
- a typo in the config options.
37+
- Fixed a typo in the config options.
2438

2539
# v2.13.2
2640

@@ -53,22 +67,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5367

5468
### Added
5569
- Named colors are now supported! Over 900 different common color names are recognized. A list of color names can be found in [core/_color_data.py](https://github.com/kyb3r/modmail/blob/master/core/_color_data.py).
56-
- Named colors can be set the same way as hex. But this can only be done through `?config set`, which means database modifications will not work.
57-
- For example: `?config set main_color yellowish green`.
70+
- Named colors can be set the same way as hex. But this can only be done through `config set`, which means database modifications will not work.
71+
- For example: `config set main_color yellowish green`.
5872
- New config var `main_color` allows you to customize the main Modmail color (as requested by many). Defaults to Discord `blurple`.
5973

6074
# v2.12.3
6175

6276
### Fixed
63-
- Patched a bug where `?logs` sub-commands were accessible by anyone.
77+
- Patched a bug where `logs` sub-commands were accessible by anyone.
6478
- Patched a bug where an error was raised if there was an open thread where the recipient had left the server.
6579

6680
Huge thanks to Sasiko for reporting these issues.
6781

6882
# v2.12.2
6983

7084
### Fixed
71-
- Fixed a bug in self-hosted `?update` command.
85+
- Fixed a bug in self-hosted `update` command.
7286

7387
# v2.12.1
7488

@@ -97,7 +111,7 @@ In the future, the Modmail API (https://modmail.tk) will be deprecated. This is
97111
- `logs closed-by [user]` this returns all logs closed by a certain user
98112

99113
### Fixed
100-
- `?activity listening to music` no longer result in two "to"s ("listening to to music").
114+
- `activity listening to music` no longer result in two "to"s ("listening to to music").
101115
- This may require you to change your activity message to accommodate this fix.
102116
- A problem where `main_category_id` and `log_channel_id` weren't updated when their corresponding channel or category get deleted.
103117

0 commit comments

Comments
 (0)