Guides
Logging
See what Kurogane and Chromium do and read the errors your app reports when it can't start.
Kurogane reports what it does through tracing events. Lifecycle and IPC detail go to debug. Problems go to warn and error.
Kurogane never writes to stdout or stderr itself. The one exception is the error run_or_exit prints when your app can’t start. Nothing appears until your app installs a subscriber.
Print Kurogane’s log
Add tracing-subscriber:
[dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
Install it before the app starts:
use tracing_subscriber::EnvFilter;
use tracing_subscriber::filter::LevelFilter;
fn main() {
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::WARN.into())
.from_env_lossy(),
)
.log_internal_errors(false)
.init();
kurogane::App::new("content").run_or_exit();
}
Warnings and errors then print by default. Add the detail with RUST_LOG:
RUST_LOG=kurogane=debug kurogane dev
Any other tracing subscriber works the same way.
What the debug log shows
- Each step of startup and shutdown
- Each browser and window as it opens and closes
- IPC traffic between pages and your handlers
- The final command line Chromium starts with
- Every switch Chromium holds otherwise than Kurogane passed it
Chromium ignores a switch or feature name it doesn’t know without a word. The last two lines are how you spot one. See Chromium flags and preferences.
Chromium’s own log
Chromium keeps a log of its own apart from Kurogane’s. Kurogane leaves its settings at CEF’s defaults. CEF reads the log-file and log-severity switches for them:
use kurogane::App;
fn main() {
App::new("content")
.chromium_flag_with_value("log-severity", "verbose")
.chromium_flag_with_value("log-file", "chromium.log")
.run_or_exit();
}
When the app can’t start
App::run_or_exit prints the error with each of its causes and exits with code 1. App::run returns it as a RuntimeError for your app to handle.
A configuration problem is RuntimeError::InvalidConfiguration. It lists every problem the builder found before anything started.
When the Chromium runtime can’t be used the error says which runtime failed and how to fix it:
| Error | When |
|---|---|
CefNotInstalled |
no runtime of your app’s CEF version is installed |
CefPathMissing |
CEF_PATH names no directory |
CefVersionMismatch |
the runtime is another CEF build than the one your app was built against |
InvalidCefRuntime |
the runtime is incomplete |
CefVersionMismatch and InvalidCefRuntime carry a CefLocation. Each message gives the fix for its location:
| Location | Fix |
|---|---|
Bundle |
reinstall the app |
BesideExecutable |
remove the runtime beside the executable or replace it with the right CEF |
CefPath |
point CEF_PATH at the right CEF or unset it |
Installed |
remove it and reinstall it with kurogane install |
kurogane doctor checks the runtime, the build tools and the project before you run anything.