log -> tracing
This commit is contained in:
parent
a2e5dad97c
commit
35e08cb5d1
|
@ -4,6 +4,8 @@ use std::process::{Child, Command, ExitStatus, Stdio};
|
|||
use std::sync::mpsc::{self, sync_channel, Receiver, SyncSender};
|
||||
use std::thread::{self, JoinHandle};
|
||||
|
||||
use tracing::{debug, error, info};
|
||||
|
||||
// Specifically set to fall under 1/2 of the AMQP library's
|
||||
// SyncSender limitation.
|
||||
const OUT_CHANNEL_BUFFER_SIZE: usize = 30;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use log::{info, log};
|
||||
use ofborg::commentparser;
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp;
|
||||
|
@ -8,6 +7,8 @@ use ofborg::worker;
|
|||
|
||||
use std::env;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::error::Error;
|
|||
use std::path::Path;
|
||||
|
||||
use async_std::task;
|
||||
use log::{info, log, warn};
|
||||
use tracing::{info, warn};
|
||||
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
use ofborg::easylapin;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use amqp::Basic;
|
||||
use log::{info, log};
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
use ofborg::tasks;
|
||||
|
@ -7,6 +6,8 @@ use ofborg::worker;
|
|||
|
||||
use std::env;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use amqp::Basic;
|
||||
use log::{info, log};
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
use ofborg::tasks;
|
||||
|
@ -7,6 +5,9 @@ use ofborg::worker;
|
|||
|
||||
use std::env;
|
||||
|
||||
use amqp::Basic;
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use amqp::Basic;
|
||||
use log::{info, log};
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
use ofborg::tasks;
|
||||
|
@ -7,6 +5,9 @@ use ofborg::worker;
|
|||
|
||||
use std::env;
|
||||
|
||||
use amqp::Basic;
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use log::{info, log};
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
use ofborg::tasks;
|
||||
|
@ -7,6 +6,8 @@ use ofborg::worker;
|
|||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use log::{info, log};
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp;
|
||||
use ofborg::message::{buildjob, Pr, Repo};
|
||||
|
@ -9,6 +8,8 @@ use std::env;
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use amqp::Basic;
|
||||
use log::{error, info, log};
|
||||
use ofborg::checkout;
|
||||
use ofborg::config;
|
||||
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
|
||||
|
@ -11,6 +9,9 @@ use std::env;
|
|||
use std::path::Path;
|
||||
use std::process;
|
||||
|
||||
use amqp::Basic;
|
||||
use tracing::{error, info};
|
||||
|
||||
fn main() {
|
||||
let memory_info = sys_info::mem_info().expect("Unable to get memory information from OS");
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use amqp::Basic;
|
||||
use hyper::server::{Request, Response, Server};
|
||||
use log::{info, log};
|
||||
use ofborg::easyamqp::{ChannelExt, ConsumerExt};
|
||||
use ofborg::{config, easyamqp, stats, tasks, worker};
|
||||
|
||||
use std::env;
|
||||
use std::thread;
|
||||
|
||||
use amqp::Basic;
|
||||
use hyper::server::{Request, Response, Server};
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||
ofborg::setup_log();
|
||||
|
|
|
@ -6,6 +6,8 @@ use std::io::{Error, ErrorKind};
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
use tracing::info;
|
||||
|
||||
pub struct CachedCloner {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ use std::io::{Error, ErrorKind};
|
|||
use std::path::PathBuf;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
pub struct Lock {
|
||||
lock: Option<fs::File>,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use nom::types::CompleteStr;
|
||||
use tracing::warn;
|
||||
|
||||
pub fn parse(text: &str) -> Option<Vec<Instruction>> {
|
||||
let instructions: Vec<Instruction> = text
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use tracing::warn;
|
||||
|
||||
pub struct CommitStatus<'a> {
|
||||
api: hubcaps::statuses::Statuses<'a>,
|
||||
sha: String,
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
use crate::acl;
|
||||
use crate::nix::Nix;
|
||||
|
||||
use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials};
|
||||
use hyper::net::HttpsConnector;
|
||||
use hyper::Client;
|
||||
use hyper_native_tls::NativeTlsClient;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials};
|
||||
use hyper::net::HttpsConnector;
|
||||
use hyper::Client;
|
||||
use hyper_native_tls::NativeTlsClient;
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Config {
|
||||
pub runner: RunnerConfig,
|
||||
|
|
|
@ -2,6 +2,7 @@ use crate::config::RabbitMQConfig;
|
|||
use crate::ofborg;
|
||||
|
||||
use amqp::Basic;
|
||||
use tracing::info;
|
||||
|
||||
pub struct ConsumeConfig {
|
||||
/// Specifies the name of the queue to consume from.
|
||||
|
|
|
@ -21,6 +21,7 @@ use lapin::types::{AMQPValue, FieldTable};
|
|||
use lapin::{
|
||||
BasicProperties, Channel, CloseOnDrop, Connection, ConnectionProperties, ExchangeKind,
|
||||
};
|
||||
use tracing::debug;
|
||||
|
||||
pub fn from_config(cfg: &RabbitMQConfig) -> Result<CloseOnDrop<Connection>, lapin::Error> {
|
||||
let mut props = FieldTable::default();
|
||||
|
@ -146,7 +147,7 @@ impl<W: SimpleNotifyWorker + 'static> ConsumerExt<W> for NotifyChannel {
|
|||
let mut chan = self.0;
|
||||
Ok(Box::pin(async move {
|
||||
while let Some(Ok(deliver)) = consumer.next().await {
|
||||
log::debug!("delivery {}", deliver.delivery_tag);
|
||||
debug!("delivery {}", deliver.delivery_tag);
|
||||
let mut receiver = ChannelNotificationReceiver {
|
||||
channel: &mut chan,
|
||||
deliver: &deliver,
|
||||
|
@ -174,25 +175,25 @@ async fn action_deliver(
|
|||
) -> Result<(), lapin::Error> {
|
||||
match action {
|
||||
Action::Ack => {
|
||||
log::debug!("action ack");
|
||||
debug!("action ack");
|
||||
chan.basic_ack(deliver.delivery_tag, BasicAckOptions::default())
|
||||
.await
|
||||
}
|
||||
Action::NackRequeue => {
|
||||
log::debug!("action nack requeue");
|
||||
debug!("action nack requeue");
|
||||
let mut opts = BasicNackOptions::default();
|
||||
opts.requeue = true;
|
||||
chan.basic_nack(deliver.delivery_tag, opts).await
|
||||
}
|
||||
Action::NackDump => {
|
||||
log::debug!("action nack dump");
|
||||
debug!("action nack dump");
|
||||
chan.basic_nack(deliver.delivery_tag, BasicNackOptions::default())
|
||||
.await
|
||||
}
|
||||
Action::Publish(mut msg) => {
|
||||
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
|
||||
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
|
||||
log::debug!("action publish {}", exch);
|
||||
debug!("action publish {}", exch);
|
||||
|
||||
let mut props = BasicProperties::default().with_delivery_mode(2); // persistent.
|
||||
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[macro_use]
|
||||
extern crate nom;
|
||||
|
||||
use std::env;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
pub mod acl;
|
||||
pub mod asynccmd;
|
||||
|
@ -90,11 +88,15 @@ pub mod ofborg {
|
|||
}
|
||||
|
||||
pub fn setup_log() {
|
||||
if env::var("RUST_LOG").is_err() {
|
||||
env::set_var("RUST_LOG", "info");
|
||||
env_logger::init().unwrap();
|
||||
info!("Defaulting RUST_LOG environment variable to info");
|
||||
} else {
|
||||
env_logger::init().unwrap();
|
||||
}
|
||||
let fmt_layer = tracing_subscriber::fmt::layer();
|
||||
let filter_layer = EnvFilter::try_from_default_env()
|
||||
.or_else(|_| EnvFilter::try_new("info"))
|
||||
.unwrap();
|
||||
|
||||
tracing_subscriber::registry()
|
||||
.with(filter_layer)
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
|
||||
tracing::info!("Logging configured");
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ use std::fs::{self, File};
|
|||
use std::io::{self, BufRead, BufReader, Read, Seek, SeekFrom, Write};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tracing::warn;
|
||||
|
||||
pub struct HydraNixEnv {
|
||||
path: PathBuf,
|
||||
nix: nix::Nix,
|
||||
|
|
|
@ -6,6 +6,8 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::io::BufRead;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tracing::{debug, info, trace};
|
||||
|
||||
pub struct OutPathDiff {
|
||||
calculator: HydraNixEnv,
|
||||
pub original: Option<(PackageOutPaths, EvaluationStats)>,
|
||||
|
|
|
@ -4,6 +4,8 @@ use crate::tasks;
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
pub struct StdenvTagger {
|
||||
possible: Vec<String>,
|
||||
selected: Vec<String>,
|
||||
|
|
|
@ -6,10 +6,11 @@ use crate::nix;
|
|||
use crate::notifyworker;
|
||||
use crate::worker;
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use uuid::Uuid;
|
||||
use tracing::{error, info};
|
||||
|
||||
pub struct BuildWorker {
|
||||
cloner: checkout::CachedCloner,
|
||||
nix: nix::Nix,
|
||||
|
|
|
@ -16,16 +16,17 @@ use crate::tasks::eval::{
|
|||
};
|
||||
use crate::tasks::evaluate::{make_gist, update_labels};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
|
||||
use chrono::Utc;
|
||||
use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
|
||||
use hubcaps::gists::Gists;
|
||||
use hubcaps::issues::{Issue, IssueRef};
|
||||
use hubcaps::repositories::Repository;
|
||||
use tracing::warn;
|
||||
use uuid::Uuid;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
|
||||
pub struct NixpkgsStrategy<'a> {
|
||||
job: &'a EvaluationJob,
|
||||
pull: &'a hubcaps::pulls::PullRequest<'a>,
|
||||
|
|
|
@ -3,6 +3,8 @@ use crate::nix;
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tracing::{info, warn};
|
||||
|
||||
enum StdenvFrom {
|
||||
Before,
|
||||
After,
|
||||
|
|
|
@ -11,15 +11,16 @@ use crate::systems;
|
|||
use crate::tasks::eval;
|
||||
use crate::worker;
|
||||
|
||||
use hubcaps::checks::CheckRunOptions;
|
||||
use hubcaps::gists::Gists;
|
||||
use hubcaps::issues::Issue;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::sync::RwLock;
|
||||
use std::time::Instant;
|
||||
|
||||
use hubcaps::checks::CheckRunOptions;
|
||||
use hubcaps::gists::Gists;
|
||||
use hubcaps::issues::Issue;
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
pub struct EvaluationWorker<E> {
|
||||
cloner: checkout::CachedCloner,
|
||||
nix: nix::Nix,
|
||||
|
|
|
@ -3,6 +3,8 @@ use crate::ghevent;
|
|||
use crate::message::{evaluationjob, Pr, Repo};
|
||||
use crate::worker;
|
||||
|
||||
use tracing::info;
|
||||
|
||||
pub struct EvaluationFilterWorker {
|
||||
acl: acl::ACL,
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ use crate::ghevent;
|
|||
use crate::message::{buildjob, evaluationjob, Pr, Repo};
|
||||
use crate::worker;
|
||||
|
||||
use tracing::{error, info};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub struct GitHubCommentWorker {
|
||||
|
|
|
@ -6,6 +6,7 @@ use crate::worker;
|
|||
|
||||
use chrono::{DateTime, Utc};
|
||||
use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
|
||||
use tracing::info;
|
||||
|
||||
pub struct GitHubCommentPoster {
|
||||
github_vend: GithubAppVendingMachine,
|
||||
|
|
|
@ -3,12 +3,13 @@ use crate::message::buildresult::BuildResult;
|
|||
use crate::worker;
|
||||
use crate::writetoline::LineWriter;
|
||||
|
||||
use lru_cache::LruCache;
|
||||
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::{Component, PathBuf};
|
||||
|
||||
use lru_cache::LruCache;
|
||||
use tracing::warn;
|
||||
|
||||
#[derive(Eq, PartialEq, Hash, Debug, Clone)]
|
||||
pub struct LogFrom {
|
||||
routing_key: String,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::stats;
|
||||
use crate::worker;
|
||||
|
||||
use tracing::error;
|
||||
|
||||
pub struct StatCollectorWorker<E> {
|
||||
events: E,
|
||||
collector: stats::MetricCollector,
|
||||
|
|
|
@ -2,6 +2,8 @@ use std::fs;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
pub struct TestScratch {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::marker::Send;
|
||||
|
||||
use amqp::protocol::basic::{BasicProperties, Deliver};
|
||||
use amqp::Basic;
|
||||
use serde::Serialize;
|
||||
|
||||
use std::marker::Send;
|
||||
use tracing::error;
|
||||
|
||||
pub struct Worker<T: SimpleWorker> {
|
||||
internal: T,
|
||||
|
|
Loading…
Reference in a new issue