From 8217238cef22727f032f96a8d8ab37515c716c42 Mon Sep 17 00:00:00 2001 From: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:19:07 +0000 Subject: [PATCH] Add option to mute the logging for `setprogress!` function (#138) * add option to mute * version bump * Update Project.toml Co-authored-by: David Widmann * apply suggestion by @devmotion --------- Co-authored-by: David Widmann --- Project.toml | 2 +- src/sample.jl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 3e2c6383..97c90709 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001" keywords = ["markov chain monte carlo", "probablistic programming"] license = "MIT" desc = "A lightweight interface for common MCMC methods." -version = "5.1.0" +version = "5.2.0" [deps] BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" diff --git a/src/sample.jl b/src/sample.jl index 58217f39..175ec8df 100644 --- a/src/sample.jl +++ b/src/sample.jl @@ -6,8 +6,10 @@ const PROGRESS = Ref(true) Enable progress logging globally if `progress` is `true`, and disable it otherwise. """ -function setprogress!(progress::Bool) - @info "progress logging is $(progress ? "enabled" : "disabled") globally" +function setprogress!(progress::Bool; silent::Bool=false) + if !silent + @info "progress logging is $(progress ? "enabled" : "disabled") globally" + end PROGRESS[] = progress return progress end