"""Logging utility for ShortcutXL."""

import datetime
import os


def xl_log(msg):
    """Append a timestamped message to %TEMP%\\shortcutxl.log."""
    log_path = os.path.join(os.environ.get('TEMP', '.'), 'shortcutxl.log')
    timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
    with open(log_path, 'a', encoding='utf-8') as f:
        f.write(f'[{timestamp}] {msg}\n')
