mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
add a few more logging statements for debugging startup (#12316)
# Description This PR adds a few more `trace!()` and `perf()` statements that allowed a deeper understanding of the nushell startup process when used with `nu -n --no-std-lib --log-level trace`. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use log::info;
|
||||
use log::{info, trace};
|
||||
#[cfg(feature = "plugin")]
|
||||
use nu_cli::read_plugin_file;
|
||||
use nu_cli::{eval_config_contents, eval_source};
|
||||
@ -27,6 +27,7 @@ pub(crate) fn read_config_file(
|
||||
config_file: Option<Spanned<String>>,
|
||||
is_env_config: bool,
|
||||
) {
|
||||
trace!("read_config_file {:?}", &config_file);
|
||||
// Load config startup file
|
||||
if let Some(file) = config_file {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
@ -129,6 +130,7 @@ pub(crate) fn read_loginshell_file(engine_state: &mut EngineState, stack: &mut S
|
||||
}
|
||||
|
||||
pub(crate) fn read_default_env_file(engine_state: &mut EngineState, stack: &mut Stack) {
|
||||
trace!("read_default_env_file");
|
||||
let config_file = get_default_env();
|
||||
eval_source(
|
||||
engine_state,
|
||||
@ -161,6 +163,11 @@ fn eval_default_config(
|
||||
config_file: &str,
|
||||
is_env_config: bool,
|
||||
) {
|
||||
trace!(
|
||||
"eval_default_config: config_file: {:?}, is_env_config: {}",
|
||||
&config_file,
|
||||
is_env_config
|
||||
);
|
||||
println!("Continuing without config file");
|
||||
// Just use the contents of "default_config.nu" or "default_env.nu"
|
||||
eval_source(
|
||||
@ -199,6 +206,12 @@ pub(crate) fn setup_config(
|
||||
env_file: Option<Spanned<String>>,
|
||||
is_login_shell: bool,
|
||||
) {
|
||||
trace!(
|
||||
"setup_config: config: {:?}, env: {:?}, login: {}",
|
||||
&config_file,
|
||||
&env_file,
|
||||
is_login_shell
|
||||
);
|
||||
let result = catch_unwind(AssertUnwindSafe(|| {
|
||||
#[cfg(feature = "plugin")]
|
||||
read_plugin_file(engine_state, stack, plugin_file, NUSHELL_FOLDER);
|
||||
@ -225,6 +238,13 @@ pub(crate) fn set_config_path(
|
||||
key: &str,
|
||||
config_file: Option<&Spanned<String>>,
|
||||
) {
|
||||
trace!(
|
||||
"set_config_path: cwd: {:?}, default_config: {}, key: {}, config_file: {:?}",
|
||||
&cwd,
|
||||
&default_config_name,
|
||||
&key,
|
||||
&config_file
|
||||
);
|
||||
let config_path = match config_file {
|
||||
Some(s) => canonicalize_with(&s.item, cwd).ok(),
|
||||
None => nu_path::config_dir().map(|mut p| {
|
||||
|
Reference in New Issue
Block a user