Skip to content

RRRRRRR-777/LogRelay

Repository files navigation

LogRelay

LogRelayは、ログメッセージをLINE, Slack, Discord, メールに転送するためのライブラリです。 ※ 現在はLINEのみで順次追加予定です。

プロジェクト情報

  • 名前: logrelay
  • バージョン: 0.1.0
  • 説明: エラーログをLINEやメールなどの方法でリレーするライブラリ
  • 依存関係:
    • requests>=2.32.3
  • README: README.md
  • Pythonバージョン: >= 3.8

インストール

pip install logrelay

使用方法 (LINE)

環境変数

  1. LINE Developers でチャネルを作成
  2. プロバイダー(または新規作成)を選択
  3. Messaging API チャネルを作成
  4. 「チャネルアクセストークン(長期)」 を取得
    • トップ > ユーザー名 > サービス名 > Messaging API設定 > チャネルアクセストークン > チャネルアクセストークン(長期)
  5. QRコードをスマートフォンで読み込み友だち追加する
    • トップ > ユーザー名 > サービス名 > Messaging API設定 > ボット情報 > QRコード
  6. 「あなたのユーザーID」を取得
    • トップ > ユーザー名 > サービス名 > チャネル基本設定 > 基本情報 > あなたのユーザーID
  7. 環境変数に値を割り当てる
    • line_access_token: チャネルアクセストークン(長期)
    • user_id: あなたのユーザーID

使用例

import requests
from logrelay import LogRelay

line_access_token = "YOUR_LINE_ACCESS_TOKEN"
user_id = "TARGET_USER_ID"

log_relay = LogRelay(line_access_token, user_id)

try:
    response = requests.get("https://example.com/api")
    response.raise_for_status()
except requests.exceptions.RequestException as e:
    error_message = f"<Example_Service>Error: {str(e)}"
    log_relay.send_line_message(error_message)
    print(error_message)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages