Skip to content

Commit

Permalink
Add document and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-dfinity committed Sep 24, 2024
1 parent a93a3f9 commit a685c3f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

`dfx start --pocketic` is now compatible with `--artificial-delay` and the `subnet_type` configuration option, and enables `--enable-canister-http` by default.

### feat: Support canister log allowed viewer list

Added support for the canister log allowed viewer list, which configures which users are allowed to read a canister's logs, with no need to be set as controller of the canister.
Valid settings are:
- `--add-log-viewer`, `--remove-log-viewer` and `--set-log-viewer` flags with `dfx canister update-settings`
- `--log-viewer` flag with `dfx canister create`
- `canisters[].initialization_values.log_visibility.allowed_viewers` in `dfx.json`

## Dependencies

### Replica
Expand Down
4 changes: 4 additions & 0 deletions docs/cli-reference/dfx-canister.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ You can use the following options with the `dfx canister create` command.
| `--memory-allocation <memory>` | Specifies how much memory the canister is allowed to use in total. This should be a value in the range [0..12 GiB]. A setting of 0 means the canister will have access to memory on a “best-effort” basis: It will only be charged for the memory it uses, but at any point in time may stop running if it tries to allocate more memory when there isn’t space available on the subnet. |
| `--reserved-cycles-limit <limit>` | Specifies the upper limit for the canister's reserved cycles. |
| `--wasm-memory-limit <limit>` | Specifies a soft upper limit for the canister's heap memory. |
| `--log-viewer <principal>` | Specifies the the principal of the log viewer of the canister. Can be specified more than once. |
| `--log-visibility <visibility>` | Specifies who is allowed to read the canister's logs. Can be either "controllers" or "public". |
| `--no-wallet` | Performs the call with the user Identity as the Sender of messages. Bypasses the Wallet canister. Enabled by default. |
| `--with-cycles <number-of-cycles>` | Specifies the initial cycle balance to deposit into the newly created canister. The specified amount needs to take the canister create fee into account. This amount is deducted from the wallet's cycle balance. |
Expand Down Expand Up @@ -1137,14 +1138,17 @@ You can specify the following options for the `dfx canister update-settings` com
| Option | Description |
|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--add-controller <principal>` | Add a principal to the list of controllers of the canister. |
| `--add-log-viewer <principal>` | Add a principal to the list of log viewers of the canister. |
| `-c`, `--compute-allocation <allocation>` | Specifies the canister's compute allocation. This should be a percent in the range [0..100]. |
| `--confirm-very-long-freezing-threshold` | Freezing thresholds above ~1.5 years require this option as confirmation. |
| `--set-controller <principal>` | Specifies the identity name or the principal of the new controller. Can be specified more than once, indicating the canister will have multiple controllers. If any controllers are set with this parameter, any other controllers will be removed. |
| `--set-log-viewer <principal>` | Specifies the the principal of the log viewer of the canister. Can be specified more than once, indicating the canister will have multiple log viewers. If any log viewers are set with this parameter, any other log viewers will be removed. |
| `--memory-allocation <allocation>` | Specifies how much memory the canister is allowed to use in total. This should be a value in the range [0..12 GiB]. A setting of 0 means the canister will have access to memory on a “best-effort” basis: It will only be charged for the memory it uses, but at any point in time may stop running if it tries to allocate more memory when there isn’t space available on the subnet. |
| `--reserved-cycles-limit <limit>` | Specifies the upper limit of the canister's reserved cycles. |
| `--wasm-memory-limit <limit>` | Specifies a soft upper limit for the canister's heap memory. |
| `--log-visibility <visibility>` | Specifies who is allowed to read the canister's logs. Can be either "controllers" or "public". |
| `--remove-controller <principal>` | Removes a principal from the list of controllers of the canister. |
| `--remove-log-viewer <principal>` | Removes a principal from the list of log viewers of the canister. |
| `--freezing-threshold <seconds>` | Set the [freezing threshold](https://internetcomputer.org/docs/current/references/ic-interface-spec/#ic-create_canister) in seconds for a canister. This should be a value in the range [0..2^64^-1]. Very long thresholds require the `--confirm-very-long-freezing-threshold` option. |
| `-y`, `--yes` | Skips yes/no checks by answering 'yes'. Such checks can result in loss of control, so this is not recommended outside of CI. |

Expand Down
3 changes: 2 additions & 1 deletion src/dfx/src/commands/canister/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ pub struct CanisterCreateOpts {
#[arg(long, value_parser = log_visibility_parser, conflicts_with("log_viewer"))]
log_visibility: Option<LogVisibility>,

/// Specifies the identity name or the principal of the new controller.
/// Specifies the the principal of the log viewer of the canister.
/// Can be specified more than once.
#[arg(long, action = ArgAction::Append, conflicts_with("log_visibility"))]
log_viewer: Option<Vec<String>>,

Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/lib/canister_logs/log_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ pub struct LogVisibilityOpt {
#[arg(long, action = ArgAction::Append, conflicts_with("set_log_viewer"))]
add_log_viewer: Option<Vec<String>>,

/// Remove a principal from the list of log viewers of the canister.
/// Removes a principal from the list of log viewers of the canister.
#[arg(long, action = ArgAction::Append, conflicts_with("set_log_viewer"))]
remove_log_viewer: Option<Vec<String>>,

/// Specifies the the principal of the log viewers of the canister.
/// Specifies the the principal of the log viewer of the canister.
/// Can be specified more than once.
#[arg(
long,
Expand Down

0 comments on commit a685c3f

Please sign in to comment.