mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-22 21:49:41 +00:00
agent: avoid policy.txt log without debug enabled
slog's is_enabled() is documented as: - "best effort", and - Sometime resulting in false positives. Use AGENT_CONFIG.log_level.as_usize() instead, to avoid those false positives. Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
parent
9f6f5dac4b
commit
aa8bdbde5a
@ -5,11 +5,10 @@
|
|||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use protobuf::MessageDyn;
|
use protobuf::MessageDyn;
|
||||||
use slog::Drain;
|
|
||||||
use tokio::io::AsyncWriteExt;
|
use tokio::io::AsyncWriteExt;
|
||||||
|
|
||||||
use crate::rpc::ttrpc_error;
|
use crate::rpc::ttrpc_error;
|
||||||
use crate::AGENT_POLICY;
|
use crate::{AGENT_CONFIG, AGENT_POLICY};
|
||||||
|
|
||||||
static POLICY_LOG_FILE: &str = "/tmp/policy.txt";
|
static POLICY_LOG_FILE: &str = "/tmp/policy.txt";
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ impl AgentPolicy {
|
|||||||
|
|
||||||
/// Initialize regorus.
|
/// Initialize regorus.
|
||||||
pub async fn initialize(&mut self, default_policy_file: &str) -> Result<()> {
|
pub async fn initialize(&mut self, default_policy_file: &str) -> Result<()> {
|
||||||
if sl!().is_enabled(slog::Level::Debug) {
|
if AGENT_CONFIG.log_level.as_usize() >= slog::Level::Debug.as_usize() {
|
||||||
self.log_file = Some(
|
self.log_file = Some(
|
||||||
tokio::fs::OpenOptions::new()
|
tokio::fs::OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user