Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PowerModels.jl Change Log

### Staged
- Relax tests to allow `INFEASIBLE_POINT` (#976)
- Silence Memento logger during precompilation (#980)

### v0.21.4
- Fix InexactError in `compute_ac_pf` (#939)
Expand Down
6 changes: 4 additions & 2 deletions src/PowerModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ __init__() = Memento.register(_LOGGER)
function silence()
Memento.info(_LOGGER, "Suppressing information and warning messages for the rest of this session. Use the Memento package for more fine-grained control of logging.")
Memento.setlevel!(Memento.getlogger(_IM), "error")
Memento.setlevel!(Memento.getlogger(PowerModels), "error")
Memento.setlevel!(_LOGGER, "error")
end

"alows the user to set the logging level without the need to add Memento"
function logger_config!(level)
Memento.config!(Memento.getlogger("PowerModels"), level)
Memento.setlevel!(_LOGGER, level)
end

const _pm_global_keys = Set(["time_series", "per_unit"])
Expand Down Expand Up @@ -86,6 +86,7 @@ include("util/flow_limit_cuts.jl")
include("core/export.jl")

PrecompileTools.@setup_workload begin
logger_config!("error") # Turn off logging for this precompile block
case3 = joinpath(dirname(@__DIR__), "test/data/matpower/case3.m")
case9 = joinpath(dirname(@__DIR__), "test/data/matpower/case9.m")
PrecompileTools.@compile_workload begin
Expand All @@ -99,6 +100,7 @@ PrecompileTools.@setup_workload begin
_ = compute_ac_pf(case9)
_ = compute_dc_pf(case9)
end
logger_config!("info") # Re-enable default logging
end

# Deprecations to be removed in the next breaking release
Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import SCS
import SparseArrays

# Suppress warnings during testing.
Memento.setlevel!(Memento.getlogger(InfrastructureModels), "error")
PowerModels.logger_config!("error")
PowerModels.silence()

# default setup for solvers
nlp_solver = JuMP.optimizer_with_attributes(
Expand Down
Loading