Remove log from zenith_utils

This commit is contained in:
Kirill Bulatov
2021-10-26 00:51:08 +03:00
committed by Kirill Bulatov
parent ecd577c934
commit d88377f9f0
5 changed files with 5 additions and 6 deletions

1
Cargo.lock generated
View File

@@ -2576,7 +2576,6 @@ dependencies = [
"hyper",
"jsonwebtoken",
"lazy_static",
"log",
"postgres",
"rand",
"routerify",

View File

@@ -11,7 +11,6 @@ byteorder = "1.4.3"
bytes = "1.0.1"
hyper = { version = "0.14.7", features = ["full"] }
lazy_static = "1.4.0"
log = "0.4.14"
postgres = { git = "https://github.com/zenithdb/rust-postgres.git", rev="9eb0dbfbeb6a6c1b79099b9f7ae4a8c021877858" }
routerify = "2"
serde = { version = "1.0", features = ["derive"] }

View File

@@ -9,6 +9,7 @@ use routerify::ext::RequestExt;
use routerify::RequestInfo;
use routerify::{Middleware, Router, RouterBuilder, RouterService};
use std::net::TcpListener;
use tracing::info;
use zenith_metrics::{new_common_metric_name, register_int_counter, IntCounter};
use zenith_metrics::{Encoder, TextEncoder};
@@ -32,7 +33,7 @@ lazy_static! {
}
async fn logger(res: Response<Body>, info: RequestInfo) -> Result<Response<Body>, ApiError> {
log::info!("{} {} {}", info.method(), info.uri().path(), res.status(),);
info!("{} {} {}", info.method(), info.uri().path(), res.status(),);
Ok(res)
}
@@ -163,7 +164,7 @@ pub fn serve_thread_main(
router_builder: RouterBuilder<hyper::Body, ApiError>,
listener: TcpListener,
) -> anyhow::Result<()> {
log::info!("Starting a http endpoint at {}", listener.local_addr()?);
info!("Starting a http endpoint at {}", listener.local_addr()?);
// Create a Service from the router above to handle incoming requests.
let service = RouterService::new(router_builder.build().map_err(|err| anyhow!(err))?).unwrap();

View File

@@ -69,7 +69,7 @@ impl HttpErrorBody {
}
pub async fn handler(err: routerify::RouteError) -> Response<Body> {
log::error!("{}", err);
tracing::error!("{}", err);
err.downcast::<ApiError>()
.expect("handler should always return api error")
.into_response()

View File

@@ -7,7 +7,6 @@ use crate::pq_proto::{BeMessage, FeMessage, FeStartupMessage, StartupRequestCode
use crate::sock_split::{BidiStream, ReadStream, WriteStream};
use anyhow::{anyhow, bail, ensure, Result};
use bytes::{Bytes, BytesMut};
use log::*;
use rand::Rng;
use serde::{Deserialize, Serialize};
use std::io::{self, Write};
@@ -16,6 +15,7 @@ use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::time::Duration;
use tracing::*;
static PGBACKEND_SHUTDOWN_REQUESTED: AtomicBool = AtomicBool::new(false);