Skip to content

Commit 5d77141

Browse files
Jerakinxente
authored andcommitted
chore/update-docs-typos
1 parent 204ddcd commit 5d77141

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ A logging handler that sends log messages to **(Grafana) Loki** in JSON format.
2222
* label_keys (dict, optional): A dictionary of keys to extract from each log message and use as labels. Defaults to None.
2323
* auth (tuple, optional): Basic authentication credentials for the Loki request. Defaults to None.
2424
* additional_headers (dict, optional): Additional headers for the Loki request. Defaults to None.
25-
* timeout (int, optional): Timeout interval in seconds to wait before flushing the buffer. Defaults to 10 seconds.
26-
* compressed (bool, optional): Whether to compress the log messages before sending them to Loki. Defaults to True.
27-
* loguru (bool, optional): Whether to use `LoguruFormatter`. Defaults to False.
28-
* default_formatter (logging.Formatter, optional): Formatter for the log records. If not provided,`LoggerFormatter` or `LoguruFormatter` will be used.
29-
* enable_self_errors (bool, optional): Set to True to show Hanlder errors on console. Defaults to False
25+
* message_in_json_format (bool): Whether to format log values as JSON.
26+
* timeout (int, optional): Timeout interval for flushing logs in seconds. Defaults to 10 seconds.
27+
* compressed (bool, optional): Whether to compress the logs before sending them using gzip. Defaults to True.
28+
* default_formatter (logging.Formatter, optional): Formatter for the log records. If not provided, `LoggerFormatter` or`LoguruFormatter` will be used.
29+
* enable_self_errors (bool, optional): Set to True to show Handler errors on console. Default False
30+
3031
### Loki 3.0
3132
* enable_structured_loki_metadata (bool, optional): Whether to include structured loki_metadata in the logs. Defaults to False. Only supported for Loki 3.0 and above
3233
* loki_metadata (dict, optional): Default loki_metadata values. Defaults to None. Only supported for Loki 3.0 and above
33-
* loki_metadata_keys (arrray, optional): Specific log record keys to extract as loki_metadata. Only supported for Loki 3.0 and above
34+
* loki_metadata_keys (array, optional): Specific log record keys to extract as loki_metadata. Only supported for Loki 3.0 and above
3435

3536
## Formatters
3637
* **LoggerFormatter**: Formatter for default python logging implementation
3738
* **LoguruFormatter**: Formatter for Loguru python library
3839

3940
## How to use
4041

41-
First create a environment varialble to setup your loki url with this structure (Ej: https://100239:wdadw....dwad@logs-prod-eu-west-0.grafana.net/loki/api/v1/push)
42+
First create an environment variable to set up your loki url with this structure (Ej: https://100239:wdadw....dwad@logs-prod-eu-west-0.grafana.net/loki/api/v1/push)
4243
````python
4344
LOKI_URL="https://{{USER}}:{{PASSWORD}}@{{GRAFANA_LOKI_URL}}/loki/api/v1/push"
4445
````
@@ -225,7 +226,7 @@ custom_handler = LokiLoggerHandler(
225226

226227
logger.addHandler(custom_handler)
227228

228-
logger.info("User acction", extra={"loki_metadata": {"user_id": 12345, "operation": "update", "status": "success"}})
229+
logger.info("User action", extra={"loki_metadata": {"user_id": 12345, "operation": "update", "status": "success"}})
229230

230231
```
231232

@@ -251,7 +252,7 @@ custom_handler = LokiLoggerHandler(
251252

252253
logger.addHandler(custom_handler)
253254

254-
logger.info("User acction", extra={"loki_metadata": {"user_id": 12345, "operation": "update", "status": "success"}, "trace_id": "000-000000-0000"})
255+
logger.info("User action", extra={"loki_metadata": {"user_id": 12345, "operation": "update", "status": "success"}, "trace_id": "000-000000-0000"})
255256

256257
```
257258

loki_logger_handler/loki_logger_handler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ def __init__(
4242
4343
Args:
4444
url (str): The URL of the Loki server.
45-
labels (dict): Default labels for the logs.
46-
label_keys (dict, optional): Specific log record keys to extract as labels. Defaults to None.
45+
labels (dict): A dictionary of labels to attach to each log message.
46+
label_keys (dict, optional): A dictionary of keys to extract from each log message and use as labels. Defaults to None.
4747
auth (tuple, optional): Basic authentication credentials for the Loki request. Defaults to None.
4848
additional_headers (dict, optional): Additional headers for the Loki request. Defaults to None.
4949
message_in_json_format (bool): Whether to format log values as JSON.
50-
timeout (int, optional): Timeout interval for flushing logs. Defaults to 10 seconds.
51-
compressed (bool, optional): Whether to compress the logs using gzip. Defaults to True.
52-
default_formatter (logging.Formatter, optional): Formatter for the log records. If not provided, LoggerFormatter or LoguruFormatter will be used.
53-
enable_self_errors (bool, optional): Set to True to show Hanlder errors on console. Default False
50+
timeout (int, optional): Timeout interval for flushing logs in seconds. Defaults to 10 seconds.
51+
compressed (bool, optional): Whether to compress the logs before sending them using gzip. Defaults to True.
52+
default_formatter (logging.Formatter, optional): Formatter for the log records. If not provided, `LoggerFormatter` or`LoguruFormatter` will be used.
53+
enable_self_errors (bool, optional): Set to True to show Handler errors on console. Default False
5454
enable_structured_loki_metadata (bool, optional): Whether to include structured loki_metadata in the logs. Defaults to False. Only supported for Loki 3.0 and above
5555
loki_metadata (dict, optional): Default loki_metadata values. Defaults to None. Only supported for Loki 3.0 and above
56-
loki_metadata_keys (arrray, optional): Specific log record keys to extract as loki_metadata. Only supported for Loki 3.0 and above
56+
loki_metadata_keys (array, optional): Specific log record keys to extract as loki_metadata. Only supported for Loki 3.0 and above
5757
"""
5858
super(LokiLoggerHandler, self).__init__()
5959

@@ -86,7 +86,7 @@ def __init__(
8686

8787
self.message_in_json_format = message_in_json_format
8888

89-
# Halndler working with errors
89+
# Handler working with errors
9090
self.error = False
9191
self.enable_structured_loki_metadata = enable_structured_loki_metadata
9292
self.loki_metadata = loki_metadata

0 commit comments

Comments
 (0)