|
46 | 46 | import com.powsybl.security.strategy.OperatorStrategy; |
47 | 47 | import org.slf4j.Logger; |
48 | 48 | import org.slf4j.LoggerFactory; |
| 49 | +import org.slf4j.event.Level; |
49 | 50 |
|
50 | 51 | import java.util.*; |
51 | 52 | import java.util.concurrent.*; |
@@ -77,6 +78,8 @@ public abstract class AbstractSecurityAnalysis<V extends Enum<V> & Quantity, E e |
77 | 78 |
|
78 | 79 | private static final String NOT_FOUND = "' not found in the network"; |
79 | 80 |
|
| 81 | + protected Level logLevel = Level.INFO; // level of the post contingency and action logs |
| 82 | + |
80 | 83 | protected AbstractSecurityAnalysis(Network network, MatrixFactory matrixFactory, GraphConnectivityFactory<LfBus, LfBranch> connectivityFactory, |
81 | 84 | List<StateMonitor> stateMonitors, ReportNode reportNode) { |
82 | 85 | this.network = Objects.requireNonNull(network); |
@@ -921,15 +924,15 @@ protected PostContingencyResult runPostContingencySimulation(LfNetwork network, |
921 | 924 | connectivityResult); |
922 | 925 | } |
923 | 926 |
|
924 | | - protected static void logPostContingencyStart(LfNetwork network, LfContingency lfContingency) { |
925 | | - LOGGER.info("Start post contingency '{}' simulation on network {}", lfContingency.getId(), network); |
| 927 | + protected void logPostContingencyStart(LfNetwork network, LfContingency lfContingency) { |
| 928 | + LOGGER.atLevel(logLevel).log("Start post contingency '{}' simulation on network {}", lfContingency.getId(), network); |
926 | 929 | LOGGER.debug("Contingency '{}' impact on network {}: remove {} buses, remove {} branches, remove {} generators, shift {} shunts, shift {} loads", |
927 | 930 | lfContingency.getId(), network, lfContingency.getDisabledNetwork().getBuses(), lfContingency.getDisabledNetwork().getBranchesStatus(), |
928 | 931 | lfContingency.getLostGenerators(), lfContingency.getShuntsShift(), lfContingency.getLostLoads()); |
929 | 932 | } |
930 | 933 |
|
931 | | - protected static void logPostContingencyEnd(LfNetwork network, LfContingency lfContingency, Stopwatch stopwatch) { |
932 | | - LOGGER.info("Post contingency '{}' simulation done on network {} in {} ms", lfContingency.getId(), |
| 934 | + protected void logPostContingencyEnd(LfNetwork network, LfContingency lfContingency, Stopwatch stopwatch) { |
| 935 | + LOGGER.atLevel(logLevel).log("Post contingency '{}' simulation done on network {} in {} ms", lfContingency.getId(), |
933 | 936 | network, stopwatch.elapsed(TimeUnit.MILLISECONDS)); |
934 | 937 | } |
935 | 938 |
|
@@ -977,13 +980,13 @@ protected OperatorStrategyResult runActionSimulation(LfNetwork network, C contex |
977 | 980 | postActionsNetworkResult.getThreeWindingsTransformerResults())); |
978 | 981 | } |
979 | 982 |
|
980 | | - protected static void logActionStart(LfNetwork network, OperatorStrategy operatorStrategy) { |
981 | | - LOGGER.info("Start operator strategy {} after contingency '{}' simulation on network {}", operatorStrategy.getId(), |
| 983 | + protected void logActionStart(LfNetwork network, OperatorStrategy operatorStrategy) { |
| 984 | + LOGGER.atLevel(logLevel).log("Start operator strategy {} after contingency '{}' simulation on network {}", operatorStrategy.getId(), |
982 | 985 | operatorStrategy.getContingencyContext().getContingencyId(), network); |
983 | 986 | } |
984 | 987 |
|
985 | | - protected static void logActionEnd(LfNetwork network, OperatorStrategy operatorStrategy, Stopwatch stopwatch) { |
986 | | - LOGGER.info("Operator strategy {} after contingency '{}' simulation done on network {} in {} ms", operatorStrategy.getId(), |
| 988 | + protected void logActionEnd(LfNetwork network, OperatorStrategy operatorStrategy, Stopwatch stopwatch) { |
| 989 | + LOGGER.atLevel(logLevel).log("Operator strategy {} after contingency '{}' simulation done on network {} in {} ms", operatorStrategy.getId(), |
987 | 990 | operatorStrategy.getContingencyContext().getContingencyId(), network, stopwatch.elapsed(TimeUnit.MILLISECONDS)); |
988 | 991 | } |
989 | 992 |
|
|
0 commit comments