Skip to content

Commit 19e56de

Browse files
committed
Utils documentation
1 parent 77a6a91 commit 19e56de

File tree

4 files changed

+62
-13
lines changed

4 files changed

+62
-13
lines changed

docs/references/authenticating.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/references/utils.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
11
.. currentmodule:: twitchio
22

33

4-
Utils
5-
#################
4+
Asset
5+
-----
66

77
.. attributetable:: twitchio.Asset
88

99
.. autoclass:: twitchio.Asset
1010
:members:
1111

12+
13+
Colour
14+
------
1215
.. attributetable:: twitchio.Colour
1316

1417
.. autoclass:: twitchio.Colour
1518
:members:
19+
20+
21+
.. autoclass:: twitchio.Color()
22+
23+
24+
Scopes
25+
------
26+
27+
.. attributetable:: twitchio.Scopes
28+
29+
.. autoclass:: twitchio.Scopes
30+
:members:
31+
32+
33+
Helpers
34+
-------
35+
36+
.. autofunction:: twitchio.utils.url_encode_datetime
37+
38+
.. autofunction:: twitchio.utils.parse_timestamp
39+
40+
.. autofunction:: twitchio.utils.setup_logging

twitchio/events.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ async def event_oauth_authorized(payload: UserTokenPayload) -> None:
1515
"""
1616

1717
async def event_ready() -> None:
18-
"""Event dispatched when the Client is ready."""
18+
"""Event dispatched when the Client is ready and has completed login."""

twitchio/utils.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,40 @@ def setup_logging(
202202
level: int | None = None,
203203
root: bool = True,
204204
) -> None:
205+
"""A helper function to setup logging for your application.
206+
207+
Parameters
208+
----------
209+
handler: :class:`logging.Handler` | None
210+
An optional :class:`logging.Handler` to use. Defaults to ``None``, which creates a :class:`logging.StreamHandler`
211+
by default.
212+
formatter: :class:`logging.Formatter` | None
213+
An optional :class:`logging.Formatter` to use. Defaults to ``None``, which uses a custom TrueColour
214+
formatter by default, falling back to standard colour support and finally no colour support if no colour
215+
is supported.
216+
level: int | None
217+
An optional int indicating the level of logging output. Defaults to ``20``, which is ``INFO``.
218+
root: bool
219+
An optional bool indicating whether logging should be setup on the root logger. When ``False``, logging will only be
220+
setup for twitchio. Defaults to ``True``.
221+
222+
Examples
223+
--------
224+
225+
.. code-block:: python3
226+
227+
import logging
228+
229+
import twitchio
230+
231+
232+
LOGGER: logging.Logger = logging.getLogger(__name__)
233+
twitchio.utils.setup_logging(level=logging.INFO)
234+
...
235+
236+
arg: str = "World!"
237+
LOGGER.info("Hello %s", arg)
238+
"""
205239
if level is None:
206240
level = logging.INFO
207241

0 commit comments

Comments
 (0)