mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
tools.vpm: debug-log to $VMODULES/cache/vpm.log
if not running in debug mode (#21192)
This commit is contained in:
parent
31fdf580a4
commit
3a6cf5adfc
3 changed files with 26 additions and 7 deletions
|
@ -19,17 +19,27 @@ mut:
|
|||
fail_on_prompt bool
|
||||
// git is used by default. URL installations can specify `--hg`. For already installed modules
|
||||
// and VPM modules that specify a different VCS in their `v.mod`, the VCS is validated separately.
|
||||
vcs VCS
|
||||
vcs VCS
|
||||
logger &log.Logger
|
||||
}
|
||||
|
||||
fn init_settings() VpmSettings {
|
||||
args := os.args[1..]
|
||||
opts := cmdline.only_options(args)
|
||||
cmds := cmdline.only_non_options(args)
|
||||
if os.getenv('VPM_DEBUG') != '' {
|
||||
log.set_level(.debug)
|
||||
}
|
||||
|
||||
vmodules_path := os.vmodules_dir()
|
||||
no_inc_env := os.getenv('VPM_NO_INCREMENT')
|
||||
dbg_env := os.getenv('VPM_DEBUG')
|
||||
|
||||
mut logger := &log.Log{}
|
||||
if dbg_env != '0' {
|
||||
logger.set_level(.debug)
|
||||
if dbg_env == '' {
|
||||
logger.set_output_path(os.join_path(vmodules_path, 'cache', 'vpm.log'))
|
||||
}
|
||||
}
|
||||
|
||||
return VpmSettings{
|
||||
is_help: '-h' in opts || '--help' in opts || 'help' in cmds
|
||||
is_once: '--once' in opts
|
||||
|
@ -37,9 +47,10 @@ fn init_settings() VpmSettings {
|
|||
is_force: '-f' in opts || '--force' in opts
|
||||
server_urls: cmdline.options(args, '--server-urls')
|
||||
vcs: if '--hg' in opts { .hg } else { .git }
|
||||
vmodules_path: os.vmodules_dir()
|
||||
vmodules_path: vmodules_path
|
||||
tmp_path: os.join_path(os.vtmp_dir(), 'vpm_modules')
|
||||
no_dl_count_increment: os.getenv('CI') != '' || (no_inc_env != '' && no_inc_env != '0')
|
||||
fail_on_prompt: os.getenv('VPM_FAIL_ON_PROMPT') != ''
|
||||
logger: logger
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue