Do not use env logger, call log instead directly (#11)

* Do not use env logger, call log instead directly

* update example
This commit is contained in:
Ayrat Badykov 2021-08-22 21:25:49 +03:00 committed by GitHub
parent d166313cab
commit 4bf654c9b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View file

@ -19,5 +19,4 @@ chrono = "0.4"
serde_json = "1.0" serde_json = "1.0"
typetag = "0.1" typetag = "0.1"
log = "0.4.0" log = "0.4.0"
env_logger = "0.9.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -9,3 +9,4 @@ edition = "2018"
fang = { path = "../../" } fang = { path = "../../" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
dotenv = "0.15.0" dotenv = "0.15.0"
env_logger = "0.9.0"

View file

@ -8,6 +8,8 @@ use simple_worker::MyJob;
fn main() { fn main() {
dotenv().ok(); dotenv().ok();
env_logger::init();
let mut worker_params = WorkerParams::new(); let mut worker_params = WorkerParams::new();
worker_params.set_retention_mode(RetentionMode::KeepAll); worker_params.set_retention_mode(RetentionMode::KeepAll);

View file

@ -2,6 +2,7 @@ use crate::queue::Queue;
use crate::queue::Task; use crate::queue::Task;
use diesel::pg::PgConnection; use diesel::pg::PgConnection;
use diesel::r2d2::{ConnectionManager, PooledConnection}; use diesel::r2d2::{ConnectionManager, PooledConnection};
use log::error;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;

View file

@ -3,9 +3,6 @@
#[macro_use] #[macro_use]
extern crate diesel; extern crate diesel;
#[macro_use]
extern crate log;
pub mod executor; pub mod executor;
pub mod queue; pub mod queue;
pub mod scheduler; pub mod scheduler;

View file

@ -4,6 +4,8 @@ use crate::executor::Executor;
use crate::executor::RetentionMode; use crate::executor::RetentionMode;
use crate::executor::SleepParams; use crate::executor::SleepParams;
use crate::queue::Queue; use crate::queue::Queue;
use log::error;
use log::info;
use std::thread; use std::thread;
pub struct WorkerPool { pub struct WorkerPool {
@ -77,8 +79,6 @@ impl WorkerPool {
} }
pub fn start(&self) { pub fn start(&self) {
env_logger::init();
for idx in 1..self.number_of_workers + 1 { for idx in 1..self.number_of_workers + 1 {
let worker_type = self let worker_type = self
.worker_params .worker_params