Public export for Loggable derive.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
pub mod macros;
|
||||
|
||||
pub use libclide_macros::Loggable;
|
||||
pub trait Loggable {
|
||||
const ID: &'static str;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//!
|
||||
//! The Loggable trait can be implemented to automatically associate log messages with a struct.
|
||||
//! ```
|
||||
//! use libclide_macros::Loggable;
|
||||
//! use libclide::log::Loggable;
|
||||
//!
|
||||
//! #[derive(Loggable)]
|
||||
//! struct MyStruct;
|
||||
@@ -35,7 +35,7 @@ macro_rules! info {
|
||||
log::info!(target: $target, $($arg)+)
|
||||
});
|
||||
|
||||
($($arg:tt)+) => (log::info!(target: <Self as libclide::log::Loggable>::ID, $($arg)+))
|
||||
($($arg:tt)+) => (log::info!(target: Self::ID, $($arg)+))
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -44,7 +44,7 @@ macro_rules! debug {
|
||||
log::debug!(target: $target, $($arg)+)
|
||||
});
|
||||
|
||||
($($arg:tt)+) => (log::debug!(target: <Self as libclide::log::Loggable>::ID, $($arg)+))
|
||||
($($arg:tt)+) => (log::debug!(target: Self::ID, $($arg)+))
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -53,7 +53,7 @@ macro_rules! warn {
|
||||
log::warn!(target: $target, $($arg)+)
|
||||
});
|
||||
|
||||
($($arg:tt)+) => (log::warn!(target: <Self as libclide::log::Loggable>::ID, $($arg)+))
|
||||
($($arg:tt)+) => (log::warn!(target: Self::ID, $($arg)+))
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -62,7 +62,7 @@ macro_rules! error {
|
||||
log::error!(target: $target, $($arg)+)
|
||||
});
|
||||
|
||||
($($arg:tt)+) => (log::error!(target: <Self as libclide::log::Loggable>::ID, $($arg)+))
|
||||
($($arg:tt)+) => (log::error!(target: Self::ID, $($arg)+))
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
@@ -71,5 +71,5 @@ macro_rules! trace {
|
||||
log::trace!(target: $target, $($arg)+)
|
||||
});
|
||||
|
||||
($($arg:tt)+) => (log::trace!(target: <Self as libclide::log::Loggable>::ID, $($arg)+))
|
||||
($($arg:tt)+) => (log::trace!(target: Self::ID, $($arg)+))
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ mod menu_bar;
|
||||
|
||||
use crate::AppContext;
|
||||
use anyhow::{Context, Result};
|
||||
use libclide_macros::Loggable;
|
||||
use log::LevelFilter;
|
||||
use ratatui::Terminal;
|
||||
use libclide::log::Loggable;
|
||||
use ratatui::backend::CrosstermBackend;
|
||||
use ratatui::crossterm::event::{
|
||||
DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
||||
|
||||
use libclide_macros::Loggable;
|
||||
use libclide::log::Loggable;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||
use ratatui::text::{Line, Span};
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::tui::logger::Logger;
|
||||
use crate::tui::menu_bar::MenuBar;
|
||||
use anyhow::{Context, Result};
|
||||
use libclide::log::Loggable;
|
||||
use libclide_macros::Loggable;
|
||||
use ratatui::DefaultTerminal;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event;
|
||||
@@ -43,7 +42,7 @@ pub struct App<'a> {
|
||||
|
||||
impl<'a> App<'a> {
|
||||
pub fn new(root_path: PathBuf) -> Result<Self> {
|
||||
libclide::trace!("Building {}", <Self as Loggable>::ID);
|
||||
libclide::trace!("Building {}", Self::ID);
|
||||
let app = Self {
|
||||
editor_tab: EditorTab::new(),
|
||||
explorer: Explorer::new(&root_path)?,
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::tui::component::Focus::Inactive;
|
||||
use Focus::Active;
|
||||
use anyhow::Result;
|
||||
use libclide::theme::colors::Colors;
|
||||
use libclide_macros::Loggable;
|
||||
use libclide::log::Loggable;
|
||||
use ratatui::crossterm::event::{Event, KeyEvent, MouseEvent};
|
||||
use ratatui::style::Color;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ use edtui::{
|
||||
EditorEventHandler, EditorState, EditorTheme, EditorView, LineNumbers, Lines, SyntaxHighlighter,
|
||||
};
|
||||
use libclide::log::Loggable;
|
||||
use libclide_macros::Loggable;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
|
||||
use ratatui::layout::{Alignment, Rect};
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::tui::component::{Action, Component, Focus, FocusState};
|
||||
use crate::tui::editor::Editor;
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use libclide::log::Loggable;
|
||||
use libclide_macros::Loggable;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState
|
||||
use anyhow::{Context, Result, bail};
|
||||
use libclide::fs::entry_meta::EntryMeta;
|
||||
use libclide::log::Loggable;
|
||||
use libclide_macros::Loggable;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, MouseEvent, MouseEventKind};
|
||||
use ratatui::layout::{Alignment, Position, Rect};
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
||||
use libclide::log::Loggable;
|
||||
use libclide_macros::Loggable;
|
||||
use log::LevelFilter;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::tui::menu_bar::MenuBarItemOption::{
|
||||
About, CloseTab, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use libclide_macros::Loggable;
|
||||
use libclide::log::Loggable;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::crossterm::event::{KeyCode, KeyEvent};
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
Reference in New Issue
Block a user