Log management
A log is generated each time you run a task, either using
gage run or gage eval.
If you’re an Inspect user, logs are created when you run
inspect eval. Gage works directly with these logs.
gage eval command is simply another way to
run inspect eval — Inspect performs the
same work in both cases.
Log dir
By default, Inspect logs are located in the project logs directory.
gage status
You can check the logs location using gage status
There are several ways to specify where logs are written.
- Use the
--log-diroption with a Gage command - Use
INSPECT_LOG_DIRenvironment variable - Define
log_dirin a Gage profile
Gage uses the Inspect rules for setting the log directory as described in Inspect log docs.
You can alternatively set the log directory in a profile.
Here’s a configuration that uses different log locations for each profile.
profiles.dev.logs_dir = "logs-dev" profiles.test.logs_dir = "logs-test"
To activate a profile, call [gage profile use][gage-profile-use] with
the profile name. You can see a list of defined profiles for a project
by running [gage profile list][gage-profile-list].
Once activated, a profile’s log directory is applied to all Gage commands.
Profiles are not applied when you run Inspect commands directly. For example, if you run
inspect eval, the activated Gage profile log directory is not applied. In this case, use theINSPECT_LOG_DIRenvironment variable. You can specify the log dir usingINSPECT_LOG_DIRin a.envto automatically apply it each time you run an Inspect command, as well as Gage commands.
List logs
To list logs, use gage list.
gage list
Gage limits the number of logs shown to fit your terminal. If you need
to see older logs, use the -m option to “show more”.
Delete logs
When you build using eval driven development, you create a lot of
logs. Gage lets you quickly delete logs you don’t care about using
gage delete.
gage delete LOGS
LOGS can be a few things:
- The log index, as shown in the
#column — e.g.gage delete 2deletes log #2 in the list - A range of index values in the format
START:STOP— e.g.gage delete 2:4deletes logs #2, #3, and #4 - A log ID, as shown in the
Idcolumn
You can specify multiple values for LOGS.
Here’s a command that deletes logs several logs as specified by index, range, and ID.
gage delete 3 5:7 hmGjE3
Log IDs can be abbreviated to a shorter prefix as long as the abbreviation uniquely identifies a single log. If an abbreviation could apply to more than one log, Gage shows an error.
Restore deleted logs
If you delete a log by accident, or want to restore a log later, use
gage log restore.
gage log restore LOGS
The LOGS argument is the same as that used when you delete the logs.
To show deleted logs, use gage list with the --deleted
option.
gage list --deleted
Permanently delete logs
Deleted logs continue to take up disk space. If you want to permanently
delete the logs, use [gage log purge][gage-log-purge].
gage log purge LOGS
If you’re confident that you won’t need a log in the future, you can
delete the log with the --permanent option.
gage delete --permanent LOGS
Confirm log operations
Gage confirms each of the operations above before executing them. This lets you review what’s about to happen before proceeding.
If you want to skip the confirmation, include the --yes option when
you run the command.
For example, this command deletes logs 1 and 2 without prompting you.
gage delete 1 2 --yes