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:
parent
d166313cab
commit
4bf654c9b5
6 changed files with 6 additions and 6 deletions
|
@ -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"] }
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue