semvec/pypi-packages huggingface dataset:
loguru-loki-handler 0.1.1
Handler created for Loguru that sends logs to Grafana Loki in JSON format
Keywords: loki,loguru

# loguru-loki-handlers

Handler created for Loguru that sends logs to Grafana Loki in JSON format

## Features

* Logs pushed in JSON format
* Custom labels definition
* Allows defining loguru and logger extra keys as labels
* Logger extra keys added automatically as keys into pushed JSON

## How to use

```python
from loguru_loki_handler import loki_handler
from loguru import logger
import os 

os.environ["LOKI_URL"]="https://USER:PASSWORD@logs-prod-eu-west-0.grafana.net/loki/api/v1/push"

logger.configure(handlers=[{"sink":  loki_handler(os.environ["LOKI_URL"],{"application":"Test", "envornment":"Develop"}), "serialize": True}])
logger.info("Starting service")
logger.info("Response code {code} HTTP/1.1 GET {url}", code=200, url="https://loki_handler.io")

```

## Loki messages samples

### Without extra

```json
{
  "message": "Starting service",
  "timestamp": 1681638266.542849,
  "process": 48906,
  "thread": 140704422327936,
  "function": "run",
  "module": "test",
  "name": "__main__"
}

```

### With extra

```json
{
  "message": "Request return 200 HTTP/1.1 GET https://loki_handler.io",
  "timestamp": 1681638225.877143,
  "process": 48870,
  "thread": 140704422327936,
  "function": "run",
  "module": "test",
  "name": "__main__",
  "code": 200,
  "url": "https://loki_handler.io"
}
```

### Exceptions

```json
{
  "message": "name 'plan' is not defined",
  "timestamp": 1681638284.358464,
  "process": 48906,
  "thread": 140704422327936,
  "function": "run",
  "module": "test",
  "name": "__main__",
  "file": "test.py",
  "path": "/test.py",
  "line": 39
}
```

## Loki Query Sample

Loki query sample :

 ```
 {envornment="Develop"} |= `` | json
 ```

Filter by level:

```
{envornment="Develop", level="INFO"} |= `` | json
```
Filter by extra:

```
{envornment="Develop", level="INFO"} |= `` | json | code=`200`
```

## License
The MIT License
ezmse 0.1.2
A Python package for generating custom Magic: The Gathering cards

<div align="center">
    <img src="https://i.imgur.com/ldS8Akl.png">
    <img src="https://img.shields.io/pypi/v/ezmse?label=PyPI%20Version">
    <img src="https://github.com/TomTkacz/EasyMSE/actions/workflows/unit-tests.yml/badge.svg">
</div>
<br>

EasyMSE is a Python package for creating Magic: The Gathering cards from code or the command line. It interfaces with an installation of Magic Set Editor 2 and its built in CLI to make generating custom cards easier.

# Installation

With Python and PIP installed, open a terminal and enter `pip install ezmse`

You must have [Magic Set Editor 2](https://magicseteditor.boards.net/page/downloads) installed. Your working directory must contain the .exe and .com versions of MSE as well as its data and resource folder. You must also have the [Magic - M15 fonts](https://github.com/MagicSetEditorPacks/Font-Pack) installed on your computer in order for the cards to render properly.

# Usage

## Generating a Card

```python
from ezmse import Card

myCard = Card()
myCard.name = "Cheese, The Destroyer"
myCard.color = "red,black"
myCard.castingCost = "2RB"
myCard.type = "Legendary Creature - Cat"
myCard.rarity = "Rare"
myCard.superType = "Legendary"
myCard.power = 5
myCard.toughness = 6
myCard.illustrator = "Kev Walker"
myCard.setCode = "XXX-XX"
myCard.text = r"Indestructible\n<sym>T</sym>: Draw one BILLION cards"
myCard.image = "cheese.jpg"

myCard.export("cheese-the-destroyer.png")
```

<div align="center">
    <img src="https://i.imgur.com/hEl6eJx.png">
</div>

# Developing EasyMSE

Clone the repository, navigate to the root folder, and enter `pip install -e .[dev]`

Features that need added:

* A more genericized Card class that can generate other types of cards (Planeswalker, Saga, etc.)
* Flavor text
* More unit tests! (I'm fairly new to them)
* A way to make pyfakefs a development-only dependency (only including it in the dev section of setup.py makes the unit tests error out upon deployment)