πŸ“ Duck Logging SystemΒΆ

Logging
Duck Framework


Duck provides an extensive and customizable logging system to track your application’s behavior and errors.

By default, every Duck app session is logged to a file. To disable file logging, set:

LOG_TO_FILE = False

⚑ Other Logging Options¢

SILENTΒΆ

Disables all logging, including console output and log files.

  • Useful in testing environments to avoid unnecessary logs.

DJANGO_SILENTΒΆ

Disables logging only for Django integration (USE_DJANGO=True).

LOGGING_DIRΒΆ

Directory to store log files.

  • Default: assets/logs

  • Can be customized to any directory path.

LOG_FILE_FORMATΒΆ

Controls the filename format for log files.

  • Default: Uses [year, month, day]_[hour, minutes, seconds]

  • Avoids : in time for Windows compatibility.

PREFERRED_LOG_STYLEΒΆ

Choose the preferred log style:

  • "duck" β†’ Clean, readable logs (default)

  • "django" β†’ Django-style logs

  • None β†’ Auto-selects based on USE_DJANGO setting

VERBOSE_LOGGINGΒΆ

Provides detailed exceptions with tracebacks.

  • Always True in DEBUG mode.

  • Set to False to reduce verbosity.


πŸ–₯️ Logs CLIΒΆ

Duck comes with a command-line tool for managing logs.

cd myduckproject
duck logs list   # List all logs
duck purge       # Delete all logs

CLI FlagsΒΆ

Flag

Description

-s

Sort logs by "oldest", "newest", "largest"

-ss

Show log sizes in human-readable units (KB, MB)

-n

Target a specific number of logs

Other CommandsΒΆ

  • size β†’ Shows total size of all logs

  • count β†’ Counts total number of logs


✨ Duck logging allows you to track, analyze, and manage logs efficiently, whether for development, debugging, or production monitoring.