Skip to main content

simple logger for message services.

Project description

agarilog

PyPI version Python versions

This is simple logger for message service.

想定用途

長時間のバッチ処理やサービスのデモなどのloggerを想定。
他から呼ばれることを想定したライブラリなどには向きません。

Installation

pip install agarilog

Features

Use .env file.

>>> import agarilog as logger
>>> logger.info("Hello agarilog!")

Use any .env file.

>>> from agarilog import get_logger
>>> logger = get_logger(name=__name__, env_file="dev.env")
>>> logger.info("Hello agarilog!")

This is use dev.env file.

Telegram

https://github.com/sakuv2/agarilog/blob/main/img/telegram_sample.png?raw=true

Slack

https://github.com/sakuv2/agarilog/blob/main/img/slack_sample.png?raw=true

Chatwork

https://github.com/sakuv2/agarilog/blob/main/img/chatwork_sample.png?raw=true

Terminal

https://github.com/sakuv2/agarilog/blob/main/img/terminal_sample.png?raw=true

Environment

環境変数にサービスごとの設定を登録する。
もしくは実行パスと同じ場所の .env ファイルに記述する。
importの方法を変えることで任意のファイルを読み込むこともできる。(上記参照)
web系の設定は LOG_XXXX_LIMIT を用いて並列で送信するログの数に制限をかけられる。
1に設定することで、ログの順序通りに送信できる。それ以上は順序は保証されない。

Environment variables will always take priority over values loaded from a dotenv file.

LOG_XXXX_LEVEL: [“NOTSET”, “DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”]

Telegram

LOG_TELEGRAM_TOKEN=XXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYY
LOG_TELEGRAM_CHAT_ID=XXXXXXXX
LOG_TELEGRAM_LEVEL=WARNING # default is warning
LOG_TELEGRAM_LIMIT=10 # default is 10

Slack

LOG_SLACK_TOKEN=xxxx-YYYYYYYYYYYY-YYYYYYYYYYYY-xxxxxxxxxxxxxxxxxxxxx
LOG_SLACK_CHANNEL=XXXXXXXXXXX
LOG_SLACK_LEVEL=WARNING # default is warning

Chatwork

LOG_CHATWORK_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
LOG_CHATWORK_ROOM_ID=XXXXXXXXX
LOG_CHATWORK_LEVLE=WARNING # default is warning

Terminal

LOG_TERMINAL_TYPE=COLOR # default is COLOR
LOG_TERMINAL_LEVEL=WARNING # default is warning

LOG_TERMINAL_TYPE: [“NONE”, “PRINT”, “NORMAL”, “COLOR”]

Development

git clone したら最初に実行すること。
仮想環境作成と pre-commit のインストールが行われる。
$ make init

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agarilog-0.2.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

agarilog-0.2.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file agarilog-0.2.1.tar.gz.

File metadata

  • Download URL: agarilog-0.2.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.7.0 Darwin/19.6.0

File hashes

Hashes for agarilog-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e1488eed2b90fb30b2850581e2b52e0a1d46465b864c61a812a8786492ebf58d
MD5 10b79f5be9f84c4b488c9231792e9f2d
BLAKE2b-256 9bc2450a4b79755d4d6e3e681645d861878dcb0038dfdfd8e70059a1a7c48fe5

See more details on using hashes here.

File details

Details for the file agarilog-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: agarilog-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.7.0 Darwin/19.6.0

File hashes

Hashes for agarilog-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe888a5005154d47b6d3bc45f7b3823e1ad84b423d6c5df72be64eb1fb0410d
MD5 ace7edafa39aed11a2ce377fdd9c0c9b
BLAKE2b-256 42a98f6db7fdc2185f6a4232fddb8aa73556a5a7238be51a9f582da3be4e4d78

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page