Skip to content

Commit 5f5de2e

Browse files
tusharkhatriofficialphip1611
authored andcommitted
docs: clarify log level guidance in logging.md
Broaden error!() to cover any user-initiated action that fails to do what was expected (e.g. failed hotplug or live migration), not only unrecoverable startup errors. Retarget info!() at operators and users, clarify the warn!() and debug!() audiences, and document trace!(). Part of cloud-hypervisor#8440. Co-authored-by: Philipp Schuster <phip1611@gmail.com> Signed-off-by: Tushar Khatri <hello@tusharkhatri.in>
1 parent ae7c0dd commit 5f5de2e

1 file changed

Lines changed: 30 additions & 12 deletions

File tree

docs/logging.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,51 @@ The number of `-v` parameters passed to the `cloud-hypervisor` binary will deter
1313

1414
### `error!()`
1515

16-
For immediate, unrecoverable errors where it does not make sense for the execution to continue as the behaviour of the VM is considerably impacted.
16+
For any user-initiated action that cannot be carried out as expected, as
17+
well as serious or fatal conditions within the VMM itself. This covers two
18+
cases:
1719

18-
Cloud Hypervisor should exit shortly after reporting this error (with a non-zero exit code). Generally this should be used during initial construction of the VM state before the virtual CPUs have begun running code.
20+
- A requested operation fails with material impact, even if Cloud
21+
Hypervisor can continue running (e.g. a failed device hotplug, live
22+
migration, snapshot/restore, or resize). From the user's perspective the
23+
action they asked for did not happen, so it is an error to them.
24+
- An unrecoverable condition where Cloud Hypervisor cannot continue and
25+
exits with a non-zero code (e.g. conflicting command line options, or a
26+
required file that is not present).
1927

20-
A typical situation where this might occur is when the user is using command line options that conflict with each other or is trying to use a file that is not present on the filesystem.
21-
22-
Users should react to this error by checking their initial VM configuration.
28+
Users should react by checking their configuration or the requested
29+
operation.
2330

2431
### `warn!()`
2532

26-
A serious problem has occurred but the execution of the VM can continue although some functionality might be impacted.
27-
28-
A typical example of where this level of message should be generated is during an API call request that cannot be fulfilled.
29-
30-
The user should investigate the meaning of this warning and take steps to ensure the correct functionality.
33+
For abnormal conditions that neither prevent a user-initiated action nor
34+
seriously impact the VM. These are user-facing and developer-facing
35+
warnings. A typical example is an ineffectual out-of-bounds access that the
36+
VMM safely ignores.
3137

3238
### `info!()`
3339

3440
Use `-v` to enable.
3541

36-
This level is for the benefit of developers. It should be used for sporadic and infrequent messages. The same message should not "spam" the logs. The VM should be usable when this level of debugging is enabled and trying to use `stdin/stdout` and the logs are going to `stderr`.
42+
Primarily targeted at operators and users. For important but infrequent
43+
normal conditions, events, and state changes that are meaningful in production. The same message
44+
should not "spam" the logs, and the VM should remain usable when this level
45+
is enabled (e.g. using stdin/stdout while the logs go to stderr).
3746

3847
### `debug!()`
3948

4049
Use `-vv` to enable.
4150

42-
For the most verbose of logging messages. It is acceptable to "spam" the log with repeated invocations of the same message. This level of logging would be combined with `--log-file`.
51+
Developer-facing diagnostic information. It is acceptable to repeat the same
52+
message here.
53+
54+
### `trace!()`
55+
56+
Use `-vvv` to enable.
57+
58+
The most verbose level, for very detailed developer-facing information. As
59+
with `debug!()`, repeated messages are acceptable. This level is typically
60+
combined with `--log-file`.
4361

4462
## Format
4563

0 commit comments

Comments
 (0)