Skip to content

Now with Log management!

Compare
Choose a tag to compare
@wyhaines wyhaines released this 29 Sep 15:23
· 32 commits to main since this release

This release adds a "log" command to the playground that can be used to list, view, and prune logs.

$ topos-playground log -h
# ...
Log commands:
    list                       Show all of the log files that currently exist in the log directory
    view                       View a topos-playground log file. With no other flags, this defaults to the most recent log file.
    prune                      Prune log files from the log directory

$ topos-playground log view -h
# ...
Log View options:
    -i [POSITION], --index [POSITION]
                               View the log file at position POSITION, starting with the most recent log file and counting backwards. Defaults 
                               to 1, which means the most recent log file.
    -b [DATE/TIME], --before [DATE/TIME]
                               View the log file before the specified date/time. Defaults to the most recent log file.
    -a [DATE/TIME], --after [DATE/TIME]
                               View the log file after the specified date/time. Defaults to the oldest log file.

$ topos-playground log prune -h
# ...
Log Prune options:
    -n, --dry-run              Do not actually delete any files. Just show what would be deleted.
    -d [DAYS], --days [DAYS]   Prune log files older than DAYS days. Defaults to 7 days.
    -s [SIZE], --size [SIZE]   Prune log files smaller than SIZE bytes. Defaults to 1024 bytes.
                               Numbers can be suffixed to indicate units.
                                   2048
                                   2048b   2048 bytes
                                   10k
                                   10kb    10 kilobytes
                                   1m
                                   1mb     1 megabyte
                                   4g
                                   4gb     4 gigabytes
    -r [RANGE], --range [RANGE]
                               Prune log files within a given range. Files are numbered in the same manner as with the `list` command or the 
                               `view --index` command, with the most recent log file being at position 1.
                               Range syntax is as follows:
                                   10..15  files 10 through 15
                                   ..5     the 5 most recent files; i.e. files 1 to 5
                                   6..     all files, starting with the 6th most recent file
                                   ..      this would be the same as the `--all` flag
                               
                               Specific files can also be specified by number, either alone, or in a comma separated list.
                                   39      the 39th most recent file
                                   3,5,7   the 3rd, 5th, and 7th most recent files
    -a, --all                  Prune all log files.