Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

log

Logs a message when a file matches. Useful for debugging rules and testing configurations.

Syntax

# Simple form - just the message
- log: "Found file: ${name}${ext}"

# Explicit form with level
- log:
    msg: "Processing ${name}"
    level: info

Options

optiontyperequireddefaultdescription
msgstringYes-Message to log (supports templates)
levelstringNoinfoLog level

Log levels

leveldescription
debugDetailed debugging information
infoGeneral information (default)
warnWarning messages
errorError messages

Examples

Simple logging

- log: "Matched: ${name}${ext}"

Debug logging

- log:
    msg: "File details: ${name}, ext: ${ext}"
    level: debug

Log before action

actions:
  - log: "Moving ${name}${ext} to archive"
  - move: ~/Archive

Testing rules

rules:
  - name: Test Image Filter
    locations: ~/Downloads
    filters:
      - extension: [jpg, png, gif]
    actions:
      - log: "Would process image: ${name}${ext}"
      # Comment out actual action while testing
      # - move: ~/Pictures

Conditional logging

rules:
  - name: Large File Warning
    locations: ~/Downloads
    filters:
      - size:
          gt: 1GB
    actions:
      - log:
          msg: "Large file detected: ${name}${ext}"
          level: warn

Template variables

The msg field supports all template variables:

- log: "File: ${name}${ext}, Year: %Y, Month: %m"

See Templates for all available variables.

Use cases

Audit trail

Log actions for review:

rules:
  - name: Archive with Logging
    locations: ~/Downloads
    filters:
      - extension: pdf
    actions:
      - log:
          msg: "Archiving PDF: ${name}"
          level: info
      - move: ~/Archive/PDFs

Notes

  • Does not modify files in any way
  • Output goes to autotidy’s log output
  • Useful during rule development and debugging
  • Can be combined with other actions in the same rule