use short syntax for json data in logs
This commit is contained in:
parent
f593667169
commit
376b9f474d
@ -6,6 +6,7 @@ use log::{debug, info};
|
||||
use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, ModelTrait, QueryFilter,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
/// change a user's admin status. eiter they are an admin, or they aren't
|
||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||
@ -35,7 +36,7 @@ impl ChangeAdminStatusSubCommand {
|
||||
.await?
|
||||
.context(format!("No user with this id found {:?}", address))?;
|
||||
|
||||
debug!("user: {}", serde_json::to_string_pretty(&user)?);
|
||||
debug!("user: {:#}", json!(&user));
|
||||
|
||||
// Check if there is a record in the database
|
||||
match admin::Entity::find()
|
||||
|
@ -7,6 +7,7 @@ use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel,
|
||||
QueryFilter,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
/// change a user's address.
|
||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||
@ -35,7 +36,7 @@ impl ChangeUserAddressSubCommand {
|
||||
.await?
|
||||
.context("No user found with that address")?;
|
||||
|
||||
debug!("initial user: {:#?}", u);
|
||||
debug!("initial user: {:#}", json!(&u));
|
||||
|
||||
if u.address == new_address {
|
||||
info!("user already has this address");
|
||||
|
@ -6,6 +6,7 @@ use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel,
|
||||
QueryFilter,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
/// change a user's tier.
|
||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||
@ -34,7 +35,7 @@ impl ChangeUserTierSubCommand {
|
||||
.await?
|
||||
.context("No user tier found with that name")?;
|
||||
|
||||
debug!("initial user_tier: {:#?}", user_tier);
|
||||
debug!("initial user_tier: {:#}", json!(&user_tier));
|
||||
|
||||
let mut user_tier = user_tier.into_active_model();
|
||||
|
||||
|
@ -7,6 +7,7 @@ use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel,
|
||||
QueryFilter,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
/// change a user's tier.
|
||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||
@ -33,7 +34,7 @@ impl ChangeUserTierByAddressSubCommand {
|
||||
.context("No user found with that key")?;
|
||||
|
||||
// TODO: don't serialize the rpc key
|
||||
debug!("user: {:#?}", user);
|
||||
debug!("user: {:#}", json!(&user));
|
||||
|
||||
// use the title to get the user tier
|
||||
let user_tier = user_tier::Entity::find()
|
||||
@ -42,7 +43,7 @@ impl ChangeUserTierByAddressSubCommand {
|
||||
.await?
|
||||
.context("No user tier found with that name")?;
|
||||
|
||||
debug!("user_tier: {:#?}", user_tier);
|
||||
debug!("user_tier: {:#}", json!(&user_tier));
|
||||
|
||||
if user.user_tier_id == user_tier.id {
|
||||
info!("user already has that tier");
|
||||
|
@ -6,6 +6,7 @@ use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel,
|
||||
QueryFilter,
|
||||
};
|
||||
use serde_json::json;
|
||||
use uuid::Uuid;
|
||||
use web3_proxy::frontend::authorization::RpcSecretKey;
|
||||
|
||||
@ -34,7 +35,7 @@ impl ChangeUserTierByKeySubCommand {
|
||||
.await?
|
||||
.context("No user tier found with that name")?;
|
||||
|
||||
debug!("user_tier: {:#?}", user_tier);
|
||||
debug!("user_tier: {:#}", json!(&user_tier));
|
||||
|
||||
// use the rpc secret key to get the user
|
||||
let user = user::Entity::find()
|
||||
@ -44,7 +45,7 @@ impl ChangeUserTierByKeySubCommand {
|
||||
.await?
|
||||
.context("No user found with that key")?;
|
||||
|
||||
debug!("user: {:#?}", user);
|
||||
debug!("user: {:#}", json!(&user));
|
||||
|
||||
if user.user_tier_id == user_tier.id {
|
||||
info!("user already has that tier");
|
||||
|
@ -250,7 +250,6 @@ impl MigrateStatsToV2 {
|
||||
|
||||
// Wait for any tasks that are on-going
|
||||
while let Some(x) = important_background_handles.next().await {
|
||||
info!("Returned item is: {:?}", x);
|
||||
match x {
|
||||
Err(e) => {
|
||||
error!("{:?}", e);
|
||||
@ -261,8 +260,6 @@ impl MigrateStatsToV2 {
|
||||
Ok(Ok(_)) => {
|
||||
// TODO: how can we know which handle exited?
|
||||
info!("a background handle exited");
|
||||
// Pop it in this case?
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use argh::FromArgs;
|
||||
use log::{error, info};
|
||||
use pagerduty_rs::{eventsv2async::EventsV2 as PagerdutyAsyncEventsV2, types::Event};
|
||||
use serde_json::json;
|
||||
use web3_proxy::{
|
||||
config::TopConfig,
|
||||
pagerduty::{pagerduty_alert, pagerduty_alert_for_config},
|
||||
@ -68,18 +69,15 @@ impl PagerdutySubCommand {
|
||||
});
|
||||
|
||||
if let Some(pagerduty_async) = pagerduty_async {
|
||||
info!(
|
||||
"sending to pagerduty: {}",
|
||||
serde_json::to_string_pretty(&event)?
|
||||
);
|
||||
info!("sending to pagerduty: {:#}", json!(&event));
|
||||
|
||||
if let Err(err) = pagerduty_async.event(Event::AlertTrigger(event)).await {
|
||||
error!("Failed sending to pagerduty: {}", err);
|
||||
}
|
||||
} else {
|
||||
info!(
|
||||
"would send to pagerduty if PAGERDUTY_INTEGRATION_KEY were set: {}",
|
||||
serde_json::to_string_pretty(&event)?
|
||||
"would send to pagerduty if PAGERDUTY_INTEGRATION_KEY were set: {:#}",
|
||||
json!(&event)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -142,10 +142,7 @@ impl SentrydSubCommand {
|
||||
);
|
||||
|
||||
if let Some(ref pagerduty_async) = pagerduty_async {
|
||||
info!(
|
||||
"sending to pagerduty: {:#}",
|
||||
serde_json::to_string_pretty(&alert)?
|
||||
);
|
||||
info!("sending to pagerduty: {:#}", json!(&alert));
|
||||
|
||||
if let Err(err) =
|
||||
pagerduty_async.event(Event::AlertTrigger(alert)).await
|
||||
|
Loading…
Reference in New Issue
Block a user