From a942ecf737ef5fe3566c338e3bba91772c2b168e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 7 Jun 2022 12:22:36 +0300 Subject: [PATCH] v.vcache: support `-d trace_usecache_n` too (less verbose tracing for just the initialisation of CacheManager) --- vlib/v/vcache/vcache.v | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vlib/v/vcache/vcache.v b/vlib/v/vcache/vcache.v index 35166bd9c7..e9ce633826 100644 --- a/vlib/v/vcache/vcache.v +++ b/vlib/v/vcache/vcache.v @@ -39,6 +39,7 @@ pub fn new_cache_manager(opts []string) CacheManager { if vcache_basepath == '' { vcache_basepath = os.join_path(os.vmodules_dir(), 'cache') } + nlog(@FN, 'vcache_basepath: $vcache_basepath | opts:\n $opts') dlog(@FN, 'vcache_basepath: $vcache_basepath | opts:\n $opts') if !os.is_dir(vcache_basepath) { os.mkdir_all(vcache_basepath) or { panic(err) } @@ -125,6 +126,15 @@ pub fn (mut cm CacheManager) load(postfix string, key string) ?string { [if trace_usecache ?] pub fn dlog(fname string, s string) { + xlog(fname, s) +} + +[if trace_usecache_n ?] +fn nlog(fname string, s string) { + xlog(fname, s) +} + +fn xlog(fname string, s string) { pid := unsafe { mypid() } if fname[0] != `|` { eprintln('> VCache | pid: $pid | CacheManager.$fname $s')