![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Python logging handler for Loki.
https://grafana.com/loki
pip install python-logging-loki
import logging
import logging_loki
handler = logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1",
)
logger = logging.getLogger("my-logger")
logger.addHandler(handler)
logger.error(
"Something happened",
extra={"tags": {"service": "my-service"}},
)
Example above will send Something happened
message along with these labels:
serverity
logger
tags
item of extra
dictThe given example is blocking (i.e. each call will wait for the message to be sent).
But you can use the built-in QueueHandler
and QueueListener
to send messages in a separate thread.
import logging.handlers
import logging_loki
from multiprocessing import Queue
queue = Queue(-1)
handler = logging.handlers.QueueHandler(queue)
handler_loki = logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1",
)
logging.handlers.QueueListener(queue, handler_loki)
logger = logging.getLogger("my-logger")
logger.addHandler(handler)
logger.error(...)
Or you can use LokiQueueHandler
shortcut, which will automatically create listener and handler.
import logging.handlers
import logging_loki
from multiprocessing import Queue
handler = logging_loki.LokiQueueHandler(
Queue(-1),
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1",
)
logger = logging.getLogger("my-logger")
logger.addHandler(handler)
logger.error(...)
FAQs
Python logging handler for Grafana Loki.
We found that python-logging-loki demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.