rename library to pt (internally)

This commit is contained in:
Christoph J. Scherr 2023-07-09 21:16:23 +02:00
parent 255c8ef3f9
commit 24f5a01f61
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
5 changed files with 16 additions and 16 deletions

View File

@ -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]]

View File

@ -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)

View File

@ -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.

View File

@ -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())
}

View File

@ -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();