import logging
import sqlite3

# Настройка логирования
logging.basicConfig(filename='bot.log', level=logging.INFO,
                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

def log_action(user_id, action, details=""):
    logging.info(f"User ID: {user_id} - Action: {action} - Details: {details}")


def log_action(user_id, action):
    conn = sqlite3.connect('bot_klining.db')
    cursor = conn.cursor()
    cursor.execute('INSERT INTO logs (user_id, action) VALUES ((SELECT id FROM users WHERE telegram_id = ?), ?)', (user_id, action))
    conn.commit()
    conn.close()
