mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Deprecate enable_logging!
in favour of configuring logging yourself
This commit is contained in:
parent
81fbb1769c
commit
dbc7633fdb
14 changed files with 21 additions and 11 deletions
|
@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `ErasedStorage`, a storage with an erased error type.
|
||||
- Allow the storage generic `S` be `?Sized` in `Dialogue` and `HandlerExt::enter_dialogue`.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- `enable_logging!` macro
|
||||
|
||||
### Fixed
|
||||
|
||||
- Log `UpdateKind::Error` in `teloxide::dispatching2::Dispatcher`.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Usage
|
||||
|
||||
```
|
||||
$ cargo run --features="full" --example <example-name>
|
||||
$ RUST_LOF=info cargo run --features="full" --example <example-name>
|
||||
```
|
||||
|
||||
Don't forget to initialise the `TELOXIDE_TOKEN` environmental variable.
|
||||
|
|
|
@ -144,7 +144,7 @@ async fn action(
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting admin_bot...");
|
||||
|
||||
let bot = teloxide::Bot::from_env().auto_send();
|
||||
|
|
|
@ -114,7 +114,7 @@ async fn callback_handler(
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -43,6 +43,9 @@ pub enum Command {
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting db_remember_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
||||
let storage: MyStorage = if std::env::var("DB_REMEMBER_REDIS").is_ok() {
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Default for State {
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting dialogue_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -4,7 +4,7 @@ use teloxide::prelude2::*;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting dices_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -13,7 +13,7 @@ use teloxide::{
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting dispatching2_features_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -36,7 +36,7 @@ use reqwest::{StatusCode, Url};
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting heroku_ping_pong_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -8,7 +8,7 @@ use teloxide::{
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting inline_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -19,7 +19,7 @@ use reqwest::{StatusCode, Url};
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting heroku_ping_pong_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -9,7 +9,7 @@ static MESSAGES_TOTAL: Lazy<AtomicU64> = Lazy::new(AtomicU64::default);
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting shared_state_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -37,7 +37,7 @@ async fn answer(
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
teloxide::enable_logging!();
|
||||
pretty_env_logger::init();
|
||||
log::info!("Starting simple_commands_bot...");
|
||||
|
||||
let bot = Bot::from_env().auto_send();
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
///
|
||||
/// [pretty-env-logger]: https://crates.io/crates/pretty_env_logger
|
||||
#[macro_export]
|
||||
#[deprecated = "Choose logging implementation yourself"]
|
||||
macro_rules! enable_logging {
|
||||
() => {
|
||||
#[allow(deprecated)]
|
||||
teloxide::enable_logging_with_filter!(log::LevelFilter::Trace);
|
||||
};
|
||||
}
|
||||
|
@ -39,6 +41,7 @@ macro_rules! enable_logging {
|
|||
/// [pretty-env-logger]: https://crates.io/crates/pretty_env_logger
|
||||
/// [`LevelFilter::Debug`]: https://docs.rs/log/0.4.10/log/enum.LevelFilter.html
|
||||
#[macro_export]
|
||||
#[deprecated = "Choose logging implementation yourself"]
|
||||
macro_rules! enable_logging_with_filter {
|
||||
($filter:expr) => {
|
||||
pretty_env_logger::formatted_builder()
|
||||
|
|
Loading…
Reference in a new issue