From 24f5a01f61df7aa80ae978708046452bece934ad Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 9 Jul 2023 21:16:23 +0200 Subject: [PATCH] rename library to pt (internally) --- Cargo.toml | 2 +- src/bin/main/mod.rs | 8 ++++---- src/logger/mod.rs | 6 +++--- tests/lib.rs | 8 ++++---- tests/test_logger_struct.rs | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a8e3ac1..b5ef99a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ categories = ["command-line-utilities", "development-tools", "development-tools: # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "libpt" +name = "pt" crate-type = ["cdylib", "rlib"] [[bin]] diff --git a/src/bin/main/mod.rs b/src/bin/main/mod.rs index 8306d32..5a68971 100644 --- a/src/bin/main/mod.rs +++ b/src/bin/main/mod.rs @@ -1,6 +1,6 @@ //! # Main executable of pt //! -//! This module contains all code specific to the executable version of [`libpt`]: [`pt`](crate). +//! This module contains all code specific to the executable version of [`pt`]: [`pt`](crate). //! //! @@ -14,7 +14,7 @@ #![warn(clippy::pedantic)] //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// -use libpt::networking::monitoring::uptime; +use pt::networking::monitoring::uptime; // we want the log macros in any case #[allow(unused_imports)] @@ -46,13 +46,13 @@ pub fn main() { if cli.log_meta { // set up our logger to use the given verbosity env_logger::Builder::new() - .filter_module("libpt", cli.verbose.log_level_filter()) + .filter_module("pt", cli.verbose.log_level_filter()) .init(); } else { // set up our logger to use the given verbosity env_logger::Builder::new() - .filter_module("libpt", cli.verbose.log_level_filter()) + .filter_module("pt", cli.verbose.log_level_filter()) .format_level(false) .format_target(false) .format_timestamp(None) diff --git a/src/logger/mod.rs b/src/logger/mod.rs index e208be4..e3878bc 100644 --- a/src/logger/mod.rs +++ b/src/logger/mod.rs @@ -1,10 +1,10 @@ -//! # A specialized Logger for [`libpt`](crate) +//! # A specialized Logger for [`pt`](crate) //! //! For the library version, only the basic [`log`] is used, so that it is possible for //! the end user to use the [`log`] frontend they desire. //! //! I did however decide to create a [`Logger`] struct. This struct is mainly intended to be used -//! with the python module of [`libpt`](crate), but is still just as usable in other contexts. +//! with the python module of [`pt`](crate), but is still just as usable in other contexts. //! //! ## Technologies used for logging: //! - [`log`]: base logging crate @@ -32,7 +32,7 @@ pub const LOGGER_ENV_KEY: &'static str = "LIBPT_LOGLEVEL"; static INITIALIZED: AtomicBool = AtomicBool::new(false); //// STRUCTS /////////////////////////////////////////////////////////////////////////////////////// -/// ## Logger for [`libpt`](crate) +/// ## Logger for [`pt`](crate) /// /// This struct exists mainly for the python module, so that we can use the same logger with both /// python and rust. diff --git a/tests/lib.rs b/tests/lib.rs index fe386dc..658af0e 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -3,10 +3,10 @@ /// These tests will not go very in depth // IMPORTS ///////////////////////////////////////////////////////////////////////////////////////// -use libpt; +use pt; -/// ## check if libpt is loaded +/// ## check if pt is loaded #[test] -fn test_libpt_is_loaded() { - assert!(libpt::is_loaded()) +fn test_pt_is_loaded() { + assert!(pt::is_loaded()) } diff --git a/tests/test_logger_struct.rs b/tests/test_logger_struct.rs index 410af53..a635c40 100644 --- a/tests/test_logger_struct.rs +++ b/tests/test_logger_struct.rs @@ -1,10 +1,10 @@ -//! # Tests for libpt::logger::Logger +//! # Tests for pt::logger::Logger //! //! Note: the module uses a global variable to store if the thread has //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// /// ## Tests for basic logging functionality -use libpt::logger::*; -use libpt::common::macros::get_stdout_for; +use pt::logger::*; +use pt::common::macros::get_stdout_for; use regex::Regex; @@ -52,7 +52,7 @@ fn test_log_basic() { // else the ANSI escape sequences break this test let regex = Regex::new(concat!( r"(?m)\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z ", - r"(TRACE|DEBUG|INFO|WARN|ERROR) +libpt::logger\] MSG" + r"(TRACE|DEBUG|INFO|WARN|ERROR) +pt::logger\] MSG" )) .unwrap();