mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-14 22:27:03 +05:30
chore(config): add trace logs
This commit is contained in:
parent
3846e67e4b
commit
a8b4b579a7
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde_derive::Deserialize;
|
use serde_derive::Deserialize;
|
||||||
|
use tracing::trace;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Replacements<'config> {
|
pub struct Replacements<'config> {
|
||||||
|
@ -67,6 +68,7 @@ pub trait Act {
|
||||||
|
|
||||||
impl Match for Matcher<'_> {
|
impl Match for Matcher<'_> {
|
||||||
fn check_match(&self, string: &str) -> bool {
|
fn check_match(&self, string: &str) -> bool {
|
||||||
|
trace!(?self, ?string, "Checking for match");
|
||||||
match self {
|
match self {
|
||||||
Matcher::StartsWith { prefix } => string.starts_with(prefix),
|
Matcher::StartsWith { prefix } => string.starts_with(prefix),
|
||||||
Matcher::EndsWith { suffix } => string.ends_with(suffix),
|
Matcher::EndsWith { suffix } => string.ends_with(suffix),
|
||||||
|
@ -96,6 +98,7 @@ impl Match for MatcherType<'_> {
|
||||||
|
|
||||||
impl Act for Action<'_> {
|
impl Act for Action<'_> {
|
||||||
fn apply_action(&self, input: &str) -> String {
|
fn apply_action(&self, input: &str) -> String {
|
||||||
|
trace!(?self, ?input, "Applying action");
|
||||||
match self {
|
match self {
|
||||||
Action::Replace { from, to } => input.replace(from, to),
|
Action::Replace { from, to } => input.replace(from, to),
|
||||||
Action::Prefix { prefix } => format!("{}{}", prefix, input),
|
Action::Prefix { prefix } => format!("{}{}", prefix, input),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue