Skip to content

Commit

Permalink
Update logger lines
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Sep 9, 2024
1 parent e5d3ad9 commit ee06ee3
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 38 deletions.
9 changes: 0 additions & 9 deletions .license.ignore
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
./applications/minotari_node/assets/tari_banner.rs
./applications/minotari_node/assets/tari_logo.rs
./applications/minotari_node/osx-pkg/entitlements.xml
./base_layer/contacts/src/schema.rs
./base_layer/key_manager/src/schema.rs
./base_layer/p2p/src/dns/roots/tls.rs
./base_layer/wallet/src/schema.rs
./docs/src/theme/book.js
./docs/src/theme/highlight.js
21 changes: 7 additions & 14 deletions log4rs_sample.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# A sample log configuration file for running in release mode. By default, this configuration splits up log messages to
# three destinations:
# * Console: For log messages with level INFO and higher
# * log/randomx_miner/network.log: INFO-level logs related to the comms crate. This file will be quite busy since there
# are lots of P2P debug messages, and so this traffic is segregated from the application log messages
# * log/randomx_miner/base_layer.log: Non-comms related INFO-level messages and higher are logged into this file
# * log/randomx_miner/other.log: Third-party crates' messages will be logged here at an ERROR level
#
# See https://docs.rs/log4rs/0.8.3/log4rs/encode/pattern/index.html for deciphering the log pattern. The log format
# used in this sample configuration prints messages as:
# timestamp [target] LEVEL message
Expand All @@ -20,9 +13,9 @@ appenders:
- kind: threshold
level: info

randomx_miner:
clythor:
kind: rolling_file
path: "{{log_dir}}/log/randomx_miner/randomx_miner.log"
path: "{{log_dir}}/log/clythor/clythor.log"
policy:
kind: compound
trigger:
Expand All @@ -32,7 +25,7 @@ appenders:
kind: fixed_window
base: 1
count: 50
pattern: "{{log_dir}}/log/randomx_miner/randomx_miner.{}.log"
pattern: "{{log_dir}}/log/clythor/clythor.{}.log"
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] {l:5} {m}{n}"

Expand All @@ -41,24 +34,24 @@ root:
level: debug
appenders:
- stdout
- randomx_miner
- clythor

loggers:
h2:
level: info
appenders:
- stdout
- randomx_miner
- clythor
additive: false
hyper:
level: info
appenders:
- stdout
- randomx_miner
- clythor
additive: false
selectors:
level: error
appenders:
- stdout
- randomx_miner
- clythor
additive: false
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl ConfigOverrideProvider for Cli {
fn get_config_property_overrides(&self, network: &mut Network) -> Vec<(String, String)> {
let mut overrides = self.common.get_config_property_overrides(network);
*network = self.common.network.unwrap_or(*network);
overrides.push(("randomx_miner.network".to_string(), network.to_string()));
overrides.push(("clythor.network".to_string(), network.to_string()));
overrides
}
}
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub enum MiningMode {

impl SubConfigPath for RandomXMinerConfig {
fn main_key_prefix() -> &'static str {
"randomx_miner"
"clythor"
}
}

Expand All @@ -68,7 +68,7 @@ impl Default for RandomXMinerConfig {
universe_address: None,
mode: Default::default(),
network: Default::default(),
config_dir: PathBuf::from("config/randomx_miner"),
config_dir: PathBuf::from("config/clythor"),
num_mining_threads: num_cpus::get(),
template_refresh_interval_ms: 15000,
}
Expand Down
2 changes: 0 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ pub enum MiningError {
Difficulty(#[from] tari_core::proof_of_work::DifficultyError),
#[error("RandomXVMFactoryError`: {0}")]
RandomXVMFactory(#[from] tari_core::proof_of_work::randomx_factory::RandomXVMFactoryError),
#[error("HexError`: {0}")]
Hex(#[from] tari_utilities::hex::HexError),
#[error("FromHexError`: {0}")]
FromHex(#[from] hex::FromHexError),
#[error("MergeMineError`: {0}")]
Expand Down
2 changes: 1 addition & 1 deletion src/json_rpc/get_block_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use serde::Deserialize;

use crate::{error::RequestError, Request};

pub const LOG_TARGET: &str = "minotari::randomx_miner::json_rpc::get_block_count";
pub const LOG_TARGET: &str = "clythor::json_rpc::get_block_count";

#[allow(dead_code)] // jsonrpc and id fields
#[derive(Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/json_rpc/get_block_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use serde_json::json;

use crate::{error::RequestError, Request};

pub const LOG_TARGET: &str = "minotari::randomx_miner::json_rpc::get_block_template";
pub const LOG_TARGET: &str = "clythor::json_rpc::get_block_template";

#[allow(dead_code)] // jsonrpc and id fields
#[derive(Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/json_rpc/submit_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use serde_json::json;

use crate::{error::RequestError, json_rpc::Request};

pub const LOG_TARGET: &str = "minotari::randomx_miner::json_rpc::submit_block";
pub const LOG_TARGET: &str = "clythor::json_rpc::submit_block";

pub async fn submit_block<'a>(client: &Client, node_address: &'a str, block_hash: String) -> Result<(), RequestError> {
let response = client
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ mod stats_store;
use run_miner::start_miner;
use tari_common::exit_codes::{ExitCode, ExitError};

pub const LOG_TARGET: &str = "minotari::randomx_miner::main";
pub const LOG_TARGET_FILE: &str = "minotari::logging::randomx_miner::main";
pub const LOG_TARGET: &str = "clythor::main";
pub const LOG_TARGET_FILE: &str = "minotari::logging::clythor::main";

// non-64-bit not supported
minotari_app_utilities::deny_non_64_bit_archs!();
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use log::*;
use minotari_app_utilities::consts;
use tari_common::{exit_codes::ExitError, initialize_logging};

pub const LOG_TARGET: &str = "minotari::randomx_miner::main";
pub const LOG_TARGET_FILE: &str = "minotari::logging::randomx_miner::main";
pub const LOG_TARGET: &str = "clythor::main";
pub const LOG_TARGET_FILE: &str = "minotari::logging::clythor::main";

mod cli;
use cli::Cli;
Expand Down Expand Up @@ -64,7 +64,7 @@ async fn main() {
async fn main_inner() -> Result<(), ExitError> {
let cli = Cli::parse();
initialize_logging(
&cli.common.log_config_path("randomx_miner"),
&cli.common.log_config_path("clythor"),
&cli.common.get_base_path(),
include_str!("../log4rs_sample.yml"),
)?;
Expand Down
2 changes: 1 addition & 1 deletion src/run_miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use crate::{
stats_store::StatsStore,
};

pub const LOG_TARGET: &str = "minotari::randomx_miner::main";
pub const LOG_TARGET: &str = "clythor::main";

pub async fn start_miner(cli: Cli) -> Result<(), Error> {
let config_path = cli.common.config_path();
Expand Down
2 changes: 1 addition & 1 deletion src/shared_dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pub const LOG_TARGET: &str = "minotari::randomx_miner::shared_dataset";
pub const LOG_TARGET: &str = "clythor::shared_dataset";

use std::sync::RwLock;

Expand Down

0 comments on commit ee06ee3

Please sign in to comment.