ロギング

以下のようにPythonのloggingモジュールを使用して、実行したスクリプト名+処理日時.logというファイルにログを出力し、ログメッセージごとに処理日時を表示するフォーマットを設定できます。

```python
import logging
import datetime

# ログファイルの名前を作成する
log_filename = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + ".log"

# ロギングの設定
logging.basicConfig(filename=log_filename, level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

# ログを出力
logging.debug('This is a debug message.')
logging.info('This is an info message.')
logging.warning('This is a warning message.')
logging.error('This is an error message.')
logging.critical('This is a critical message.')
```

このスクリプトを実行すると、実行したスクリプト名+処理日時.logという名前のログファイルが生成され、その中にログメッセージとともに処理日時が記録されます。