Repository: chainx-org/ChainX (language: rust)

Issue:
 *: remove the useless log macros, improve log



Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index f4a489fb5..f74e830b6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -761,7 +761,6 @@ dependencies = [
  "sp-core",
  "sp-runtime",
  "sp-std",
- "xpallet-support",
 ]
 
 [[package]]
@@ -865,6 +864,7 @@ dependencies = [
  "sp-version",
  "static_assertions",
  "substrate-wasm-builder-runner",
+ "xp-logging",
  "xp-mining-staking",
  "xp-protocol",
  "xp-runtime",
@@ -3207,7 +3207,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "light-bitcoin-chain",
  "light-bitcoin-crypto",
@@ -3221,7 +3221,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-chain"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "hex",
  "light-bitcoin-crypto",
@@ -3234,7 +3234,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-crypto"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "digest 0.9.0",
  "light-bitcoin-primitives",
@@ -3247,7 +3247,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-keys"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "bs58",
  "hex",
@@ -3262,7 +3262,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-merkle"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "light-bitcoin-chain",
  "light-bitcoin-primitives",
@@ -3273,7 +3273,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-primitives"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "byteorder 1.3.4",
  "fixed-hash",
@@ -3287,7 +3287,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-script"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "hex",
  "light-bitcoin-chain",
@@ -3300,7 +3300,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-serialization"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "light-bitcoin-primitives",
  "light-bitcoin-serialization-derive",
@@ -3309,7 +3309,7 @@ dependencies = [
 [[package]]
 name = "light-bitcoin-serialization-derive"
 version = "0.2.0"
-source = "git+https://github.com/chainx-org/light-bitcoin#58547a04f5b45f9adf737c4fc564c500b8f6963e"
+source = "git+https://github.com/chainx-org/light-bitcoin#00b81fb49f16a295d05b77c932c3d06f3f83f170"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -8147,7 +8147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
 dependencies = [
  "cfg-if 0.1.10",
- "rand 0.7.3",
+ "rand 0.3.23",
  "static_assertions",
 ]
 
@@ -8787,8 +8787,8 @@ name = "xp-assets-registrar"
 version = "2.0.0-alpha.4"
 dependencies = [
  "chainx-primitives",
- "frame-support",
  "impl-trait-for-tuples",
+ "sp-runtime",
 ]
 
 [[package]]
@@ -8811,6 +8811,10 @@ dependencies = [
  "sp-runtime-interface",
 ]
 
+[[package]]
+name = "xp-logging"
+version = "2.0.0-alpha.4"
+
 [[package]]
 name = "xp-mining-common"
 version = "2.0.0-alpha.4"
@@ -8878,6 +8882,7 @@ dependencies = [
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "xp-logging",
  "xp-protocol",
  "xpallet-assets-registrar",
  "xpallet-support",
@@ -8898,6 +8903,7 @@ dependencies = [
  "sp-runtime",
  "sp-std",
  "xp-assets-registrar",
+ "xp-logging",
  "xp-protocol",
  "xp-runtime",
  "xpallet-support",
@@ -8947,6 +8953,7 @@ dependencies = [
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "xp-logging",
  "xp-protocol",
  "xpallet-assets",
  "xpallet-assets-registrar",
@@ -9003,7 +9010,7 @@ dependencies = [
  "sp-io",
  "sp-runtime",
  "sp-std",
- "xp-io",
+ "xp-logging",
  "xp-protocol",
  "xpallet-assets",
  "xpallet-assets-registrar",
@@ -9032,6 +9039,7 @@ dependencies = [
  "sp-runtime",
  "sp-std",
  "xp-io",
+ "xp-logging",
  "xp-protocol",
  "xp-runtime",
  "xpallet-assets",
@@ -9088,6 +9096,7 @@ dependencies = [
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "xp-logging",
  "xp-protocol",
  "xp-runtime",
  "xpallet-assets",
@@ -9137,6 +9146,7 @@ dependencies = [
  "sp-runtime",
  "sp-std",
  "xp-genesis-builder",
+ "xp-logging",
  "xp-protocol",
  "xpallet-assets",
  "xpallet-mining-asset",
@@ -9163,6 +9173,7 @@ dependencies = [
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "xp-logging",
  "xp-mining-common",
  "xp-mining-staking",
  "xp-protocol",
@@ -9220,6 +9231,7 @@ dependencies = [
  "sp-staking",
  "sp-std",
  "xp-genesis-builder",
+ "xp-logging",
  "xp-mining-common",
  "xp-mining-staking",
  "xp-protocol",
@@ -9257,7 +9269,6 @@ dependencies = [
 name = "xpallet-support"
 version = "2.0.0-alpha.4"
 dependencies = [
- "frame-support",
  "hex",
  "parity-scale-codec",
  "serde",
@@ -9285,15 +9296,10 @@ dependencies = [
  "frame-support",
  "frame-system",
  "pallet-transaction-payment",
- "pallet-transaction-payment-rpc-runtime-api",
  "parity-scale-codec",
  "serde",
- "smallvec 1.4.2",
- "sp-core",
- "sp-io",
  "sp-runtime",
  "sp-std",
- "xpallet-support",
 ]
 
 [[package]]
@@ -9309,7 +9315,6 @@ dependencies = [
  "sp-api",
  "sp-blockchain",
  "sp-core",
- "sp-rpc",
  "sp-runtime",
  "xpallet-support",
  "xpallet-transaction-fee-rpc-runtime-api",
diff --git a/Cargo.toml b/Cargo.toml
index b80b55a1b..417436fe1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ members = [
     "primitives/assets-registrar",
     "primitives/genesis-builder",
     "primitives/io",
+    "primitives/logging",
     "primitives/mining/common",
     "primitives/mining/staking",
     "primitives/protocol",
diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml
index 475038b61..302483d88 100644
--- a/primitives/Cargo.toml
+++ b/primitives/Cargo.toml
@@ -17,9 +17,6 @@ sp-std = { version = "2.0.0", default-features = false }
 # Substrate pallets
 frame-system = { version = "2.0.0", default-features = false }
 
-# ChainX pallets
-xpallet-support = { path = "../xpallets/support", default-features = false }
-
 [features]
 default = ["std"]
 std = [
@@ -32,6 +29,4 @@ std = [
     "sp-std/std",
     # Substrate pallets
     "frame-system/std",
-    # ChainX pallets
-    "xpallet-support/std",
 ]
diff --git a/primitives/assets-registrar/Cargo.toml b/primitives/assets-registrar/Cargo.toml
index 9c50647a9..e746888fc 100644
--- a/primitives/assets-registrar/Cargo.toml
+++ b/primitives/assets-registrar/Cargo.toml
@@ -7,8 +7,8 @@ edition = "2018"
 [dependencies]
 impl-trait-for-tuples = "0.1.3"
 
-# Substrate pallets
-frame-support = { version = "2.0.0", default-features = false }
+# Substrate primitives
+sp-runtime = { version = "2.0.0", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../primitives", default-features = false }
@@ -16,8 +16,8 @@ chainx-primitives = { path = "../../primitives", default-features = false }
 [features]
 default = ["std"]
 std = [
-    # Substrate pallets
-    "frame-support/std",
+    # Substrate primitives
+    "sp-runtime/std",
     # ChainX primitives
     "chainx-primitives/std",
 ]
diff --git a/primitives/assets-registrar/src/lib.rs b/primitives/assets-registrar/src/lib.rs
index 155a6785f..e548e25af 100644
--- a/primitives/assets-registrar/src/lib.rs
+++ b/primitives/assets-registrar/src/lib.rs
@@ -5,8 +5,9 @@
 #![cfg_attr(not(feature = "std"), no_std)]
 #![deny(missing_docs)]
 
+use sp_runtime::DispatchResult;
+
 use chainx_primitives::AssetId;
-use frame_support::dispatch::DispatchResult;
 
 /// Trait for doing some stuff on the registration/deregistration of a foreign asset.
 pub trait RegistrarHandler {
diff --git a/primitives/io/src/lib.rs b/primitives/io/src/lib.rs
index b484060fd..4804de5ce 100644
--- a/primitives/io/src/lib.rs
+++ b/primitives/io/src/lib.rs
@@ -1,6 +1,7 @@
 // Copyright 2019-2020 ChainX Project Authors. Licensed under GPL-3.0.
 
 #![cfg_attr(not(feature = "std"), no_std)]
+
 use codec::{Decode, Encode};
 
 use sp_core::crypto::AccountId32;
diff --git a/primitives/logging/Cargo.toml b/primitives/logging/Cargo.toml
new file mode 100644
index 000000000..b579f13ca
--- /dev/null
+++ b/primitives/logging/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "xp-logging"
+version = "2.0.0-alpha.4"
+authors = ["The ChainX Authors"]
+edition = "2018"
+
+[features]
+default = ["std"]
+std = []
diff --git a/primitives/logging/src/lib.rs b/primitives/logging/src/lib.rs
new file mode 100644
index 000000000..8606890dc
--- /dev/null
+++ b/primitives/logging/src/lib.rs
@@ -0,0 +1,72 @@
+// Copyright 2019-2020 ChainX Project Authors. Licensed under GPL-3.0.
+
+//! Some logging macros wrapper used in ChainX.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub const RUNTIME_TARGET: &str = "runtime";
+
+#[macro_export]
+macro_rules! error {
+    (target: $target:expr, $($arg:tt)+) => (
+        frame_support::debug::error!(target: $target, $($arg)+);
+    );
+    ($($arg:tt)+) => (
+        #[cfg(feature = "std")]
+        frame_support::debug::error!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
+        #[cfg(not(feature = "std"))]
+        frame_support::debug::error!(target: "runtime", $($arg)+);
+    )
+}
+
+#[macro_export]
+macro_rules! warn {
+     (target: $target:expr, $($arg:tt)+) => (
+         frame_support::debug::warn!(target: $target, $($arg)+);
+     );
+     ($($arg:tt)+) => (
+        #[cfg(feature = "std")]
+        frame_support::debug::warn!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
+        #[cfg(not(feature = "std"))]
+        frame_support::debug::warn!(target: "runtime", $($arg)+);
+     )
+ }
+
+#[macro_export]
+macro_rules! info {
+    (target: $target:expr, $($arg:tt)+) => (
+        frame_support::debug::info!(target: $target, $($arg)+);
+    );
+    ($($arg:tt)+) => (
+        #[cfg(feature = "std")]
+        frame_support::debug::info!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
+        #[cfg(not(feature = "std"))]
+        frame_support::debug::info!(target: "runtime", $($arg)+);
+    )
+}
+
+#[macro_export]
+macro_rules! debug {
+    (target: $target:expr, $($arg:tt)+) => (
+        frame_support::debug::debug!(target: $target, $($arg)+);
+    );
+    ($($arg:tt)+) => (
+        #[cfg(feature = "std")]
+        frame_support::debug::debug!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
+        #[cfg(not(feature = "std"))]
+        frame_support::debug::debug!(target: "runtime", $($arg)+);
+    )
+}
+
+#[macro_export]
+macro_rules! trace {
+    (target: $target:expr, $($arg:tt)+) => (
+        frame_support::debug::trace!(target: $target, $($arg)+);
+    );
+    ($($arg:tt)+) => (
+        #[cfg(feature = "std")]
+        frame_support::debug::trace!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
+        #[cfg(not(feature = "std"))]
+        frame_support::debug::trace!(target: "runtime", $($arg)+);
+    )
+}
diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
index bb00faf22..0ebf574e0 100644
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -67,6 +67,7 @@ orml-currencies = { version = "0.3", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../primitives", default-features = false }
+xp-logging = { path = "../primitives/logging", default-features = false }
 xp-mining-staking = { path = "../primitives/mining/staking", default-features = false }
 xp-protocol = { path = "../primitives/protocol", default-features = false }
 xp-runtime = { path = "../primitives/runtime", default-features = false }
@@ -149,6 +150,7 @@ std = [
     "orml-currencies/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     "xp-mining-staking/std",
     "xp-protocol/std",
     "xp-runtime/std",
diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index 13bbad2c8..ebd76d57a 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -1024,7 +1024,7 @@ impl_runtime_apis! {
     impl sp_block_builder::BlockBuilder<Block> for Runtime {
         fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
             Executive::apply_extrinsic(extrinsic).map_err(|err| {
-                frame_support::debug::error!(target: xpallet_support::RUNTIME_TARGET, "[apply_extrinsic]|{:?}", err);
+                frame_support::debug::error!(target: xp_logging::RUNTIME_TARGET, "[apply_extrinsic] {:?}", err);
                 err
             })
         }
diff --git a/xpallets/assets-registrar/Cargo.toml b/xpallets/assets-registrar/Cargo.toml
index 3fb14f5e4..93ce0a6a0 100644
--- a/xpallets/assets-registrar/Cargo.toml
+++ b/xpallets/assets-registrar/Cargo.toml
@@ -20,6 +20,7 @@ frame-system = { version = "2.0.0", default-features = false }
 # ChainX primitives
 chainx-primitives = { path = "../../primitives", default-features = false }
 xp-assets-registrar = { path = "../../primitives/assets-registrar", default-features = false }
+xp-logging = { path = "../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../primitives/protocol", default-features = false }
 xp-runtime = { path = "../../primitives/runtime", default-features = false }
 
@@ -45,6 +46,7 @@ std = [
     # ChainX primitives
     "chainx-primitives/std",
     "xp-assets-registrar/std",
+    "xp-logging/std",
     "xp-protocol/std",
     "xp-runtime/std",
     # ChainX pallets
diff --git a/xpallets/assets-registrar/src/lib.rs b/xpallets/assets-registrar/src/lib.rs
index eae94ffb2..fd2b134a4 100644
--- a/xpallets/assets-registrar/src/lib.rs
+++ b/xpallets/assets-registrar/src/lib.rs
@@ -28,7 +28,7 @@ use frame_support::{
 use frame_system::ensure_root;
 
 use chainx_primitives::{AssetId, Desc, Token};
-use xpallet_support::info;
+use xp_logging::info;
 
 pub use self::types::{AssetInfo, Chain};
 pub use self::weight_info::WeightInfo;
@@ -140,7 +140,10 @@ decl_module! {
             asset.is_valid::<T>()?;
             ensure!(!Self::exists(&asset_id), Error::<T>::AssetAlreadyExists);
 
-            info!("[register_asset]|id:{:}|{:?}|is_online:{:}|has_mining_rights:{:}", asset_id, asset, is_online, has_mining_rights);
+            info!(
+                "[register_asset] id:{}, info:{:?}, is_online:{}, has_mining_rights:{}",
+                asset_id, asset, is_online, has_mining_rights
+            );
 
             Self::apply_register(asset_id, asset)?;
 
diff --git a/xpallets/assets/Cargo.toml b/xpallets/assets/Cargo.toml
index a394f6eca..c3e44cb8e 100644
--- a/xpallets/assets/Cargo.toml
+++ b/xpallets/assets/Cargo.toml
@@ -23,6 +23,7 @@ orml-traits = { version = "0.3", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../primitives", default-features = false }
+xp-logging = { path = "../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../primitives/protocol", default-features = false }
 
 # ChainX pallets
@@ -50,6 +51,7 @@ std = [
     "orml-traits/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     "xp-protocol/std",
     # ChainX pallets
     "xpallet-assets-registrar/std",
diff --git a/xpallets/assets/src/lib.rs b/xpallets/assets/src/lib.rs
index 863cde82b..d1a3fc0c1 100644
--- a/xpallets/assets/src/lib.rs
+++ b/xpallets/assets/src/lib.rs
@@ -43,8 +43,9 @@ use sp_runtime::traits::{
 };
 
 use chainx_primitives::AssetId;
+use xp_logging::{debug, error, info};
 pub use xpallet_assets_registrar::{AssetInfo, Chain};
-use xpallet_support::{debug, ensure_with_errorlog, error, info, traits::TreasuryAccount};
+use xpallet_support::traits::TreasuryAccount;
 
 pub use self::traits::{ChainT, OnAssetChanged};
 use self::trigger::AssetChangedTrigger;
@@ -198,7 +199,7 @@ decl_module! {
         ) -> DispatchResult {
             let transactor = ensure_signed(origin)?;
             let dest = T::Lookup::lookup(dest)?;
-            debug!("[transfer]|from:{:?}|to:{:?}|id:{:}|value:{:?}", transactor, dest, id, value);
+            debug!("[transfer] from:{:?}, to:{:?}, id:{}, value:{:?}", transactor, dest, id, value);
             Self::can_transfer(&id)?;
 
             Self::move_usable_balance(&id, &transactor, &dest, value).map_err::<Error::<T>, _>(Into::into)?;
@@ -219,7 +220,7 @@ decl_module! {
 
             let transactor = T::Lookup::lookup(transactor)?;
             let dest = T::Lookup::lookup(dest)?;
-            debug!("[force_transfer]|from:{:?}|to:{:?}|id:{:}|value:{:?}", transactor, dest, id, value);
+            debug!("[force_transfer] from:{:?}, to:{:?}, id:{}, value:{:?}", transactor, dest, id, value);
             Self::can_transfer(&id)?;
             Self::move_usable_balance(&id, &transactor, &dest, value).map_err::<Error::<T>, _>(Into::into)?;
             Ok(())
@@ -236,7 +237,7 @@ decl_module! {
             ensure_root(origin)?;
 
             let who = T::Lookup::lookup(who)?;
-            info!("[set_balance]|set balances by root|who:{:?}|id:{:}|balances_map:{:?}", who, id, balances);
+            info!("[set_balance] Set balance by root, who:{:?}, id:{}, balances:{:?}", who, id, balances);
             Self::set_balance_impl(&who, &id, balances)?;
             Ok(())
         }
@@ -311,49 +312,37 @@ impl<T: Trait> Module<T> {
     // can do wrapper
     #[inline]
     pub fn can_move(id: &AssetId) -> DispatchResult {
-        ensure_with_errorlog!(
-            Self::can_do(id, AssetRestrictions::MOVE),
-            Error::<T>::ActionNotAllowed,
-            "this asset do not allow move|id:{:}|action:{:?}",
-            id,
-            AssetRestrictions::MOVE,
-        );
+        if !Self::can_do(id, AssetRestrictions::MOVE) {
+            error!("Not allowed to move asset, id:{}", id);
+            return Err(Error::<T>::ActionNotAllowed.into());
+        }
         Ok(())
     }
 
     #[inline]
     pub fn can_transfer(id: &AssetId) -> DispatchResult {
-        ensure_with_errorlog!(
-            Self::can_do(id, AssetRestrictions::TRANSFER),
-            Error::<T>::ActionNotAllowed,
-            "this asset do not allow transfer|id:{:}|action:{:?}",
-            id,
-            AssetRestrictions::TRANSFER,
-        );
+        if !Self::can_do(id, AssetRestrictions::TRANSFER) {
+            error!("Not allowed to transfer asset, id:{}", id);
+            return Err(Error::<T>::ActionNotAllowed.into());
+        }
         Ok(())
     }
 
     #[inline]
     pub fn can_destroy_withdrawal(id: &AssetId) -> DispatchResult {
-        ensure_with_errorlog!(
-            Self::can_do(id, AssetRestrictions::DESTROY_WITHDRAWAL),
-            Error::<T>::ActionNotAllowed,
-            "this asset do not allow destroy withdrawal|id:{:}|action:{:?}",
-            id,
-            AssetRestrictions::DESTROY_WITHDRAWAL,
-        );
+        if !Self::can_do(id, AssetRestrictions::DESTROY_WITHDRAWAL) {
+            error!("Not allowed to destroy withdrawal asset, id:{}", id);
+            return Err(Error::<T>::ActionNotAllowed.into());
+        }
         Ok(())
     }
 
     #[inline]
     pub fn can_destroy_usable(id: &AssetId) -> DispatchResult {
-        ensure_with_errorlog!(
-            Self::can_do(id, AssetRestrictions::DESTROY_USABLE),
-            Error::<T>::ActionNotAllowed,
-            "this asset do not allow destroy free|id:{:}|action:{:?}",
-            id,
-            AssetRestrictions::DESTROY_USABLE,
-        );
+        if !Self::can_do(id, AssetRestrictions::DESTROY_USABLE) {
+            error!("Not allowed to destroy usable asset, id:{}", id);
+            return Err(Error::<T>::ActionNotAllowed.into());
+        }
         Ok(())
     }
 }
@@ -450,8 +439,10 @@ impl<T: Trait> Module<T> {
         let from_balance = Self::asset_typed_balance(from, id, from_type);
         let to_balance = Self::asset_typed_balance(to, id, to_type);
 
-        debug!("[move_balance]|id:{:}|from:{:?}|f_type:{:?}|f_balance:{:?}|to:{:?}|t_type:{:?}|t_balance:{:?}|value:{:?}",
-               id, from, from_type, from_balance, to, to_type, to_balance, value);
+        debug!(
+            "[move_balance] id:{}, from:[who:{:?}, type:{:?}, balance:{:?}], to:[who:{:?}, type:{:?}, balance:{:?}], value:{:?}",
+            id, from, from_type, from_balance, to, to_type, to_balance, value
+        );
 
         // judge balance is enough and test overflow
         let new_from_balance = from_balance
@@ -519,7 +510,7 @@ impl<T: Trait> Module<T> {
     }
 
     fn new_account(who: &T::AccountId) {
-        info!("[new_account]|create new account|who:{:?}", who);
+        info!("[new_account] account:{:?}", who);
         T::OnCreatedAccount::happened(&who)
     }
 
@@ -589,8 +580,8 @@ impl<T: Trait> Module<T> {
         let current = Self::asset_typed_balance(&who, id, type_);
 
         debug!(
-            "[issue]|issue to account|id:{:}|who:{:?}|type:{:?}|current:{:?}|value:{:?}",
-            id, who, type_, current, value
+            "[issue] account:{:?}, asset:[id:{}, type:{:?}, current:{:?}, issue:{:?}]",
+            who, id, type_, current, value
         );
 
         let new = current.checked_add(&value).ok_or(Error::<T>::Overflow)?;
@@ -611,8 +602,10 @@ impl<T: Trait> Module<T> {
     ) -> result::Result<(), DispatchError> {
         let current = Self::asset_typed_balance(&who, id, type_);
 
-        debug!("[destroy_directly]|destroy asset for account|id:{:}|who:{:?}|type:{:?}|current:{:?}|destroy:{:?}",
-               id, who, type_, current, value);
+        debug!(
+            "[destroy] account:{:?}, asset:[id:{}, type:{:?}, current:{:?}, destroy:{:?}]",
+            who, id, type_, current, value
+        );
 
         let new = current
             .checked_sub(&value)
@@ -660,11 +653,12 @@ impl<T: Trait> Module<T> {
                     Ok(())
                 }
             };
-            if let Err(e) = result {
+            if let Err(err) = result {
                 // should not fail, for set lock need to check free_balance, free_balance = usable + free
                 error!(
-                    "[update_locks]|move between usable and locked should not fail|asset_id:{:}|who:{:?}|max_locked:{:?}|current locked:{:?}|err:{:?}",
-                    currency_id, who, max_locked, current_locked, e
+                    "[update_locks] Should not be failed when move asset (usable <=> locked), \
+                    who:{:?}, asset:[id:{}, max_locked:{:?}, current_locked:{:?}], err:{:?}",
+                    who, currency_id, max_locked, current_locked, err
                 );
             }
         }
diff --git a/xpallets/assets/src/multicurrency.rs b/xpallets/assets/src/multicurrency.rs
index fca6c5fe8..21dce0073 100644
--- a/xpallets/assets/src/multicurrency.rs
+++ b/xpallets/assets/src/multicurrency.rs
@@ -17,7 +17,8 @@ use orml_traits::{
 };
 
 use chainx_primitives::AssetId;
-use xpallet_support::{error, traits::TreasuryAccount};
+use xp_logging::error;
+use xpallet_support::traits::TreasuryAccount;
 
 use crate::types::{AssetType, BalanceLock};
 use crate::{BalanceOf, Error, Module, Trait};
@@ -214,7 +215,7 @@ impl<T: Trait> MultiReservableCurrency<T::AccountId> for Module<T> {
         let actual = reserved_balance.min(value);
 
         let treasury = T::TreasuryAccount::treasury_account();
-        if let Err(e) = Self::move_balance(
+        if let Err(err) = Self::move_balance(
             &currency_id,
             who,
             AssetType::Reserved,
@@ -223,8 +224,9 @@ impl<T: Trait> MultiReservableCurrency<T::AccountId> for Module<T> {
             actual,
         ) {
             error!(
-                "[slash_reserved]|should not failed when this move|who:{:?}|asset_id:{:}|err:{:?}",
-                who, currency_id, e
+                "[slash_reserved] Should not be failed when move asset (reserved => usable), \
+                who:{:?}, id:{}, err:{:?}",
+                who, currency_id, err
             );
         }
         value - actual
@@ -263,7 +265,7 @@ impl<T: Trait> MultiReservableCurrency<T::AccountId> for Module<T> {
             return Zero::zero();
         }
         let actual = Self::reserved_balance(currency_id, who).min(value);
-        if let Err(e) = Self::move_balance(
+        if let Err(err) = Self::move_balance(
             &currency_id,
             who,
             AssetType::Reserved,
@@ -272,8 +274,9 @@ impl<T: Trait> MultiReservableCurrency<T::AccountId> for Module<T> {
             actual,
         ) {
             error!(
-                "[unreserve]|should not failed when this move|who:{:?}|asset_id:{:}|err:{:?}",
-                who, currency_id, e
+                "[unreserve] Should not be failed when move asset (reserved => usable), \
+                who:{:?}, id:{}, err:{:?}",
+                who, currency_id, err
             );
         }
         value - actual
diff --git a/xpallets/dex/spot/Cargo.toml b/xpallets/dex/spot/Cargo.toml
index 3f4892391..0ccbe323e 100644
--- a/xpallets/dex/spot/Cargo.toml
+++ b/xpallets/dex/spot/Cargo.toml
@@ -21,6 +21,7 @@ pallet-balances = { version = "2.0.0", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
+xp-logging = { path = "../../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../../primitives/protocol", default-features = false, optional = true }
 
 # ChainX pallets
@@ -50,6 +51,7 @@ std = [
     "pallet-balances/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     # ChainX pallets
     "xpallet-assets/std",
     "xpallet-assets-registrar/std",
diff --git a/xpallets/dex/spot/src/execution/mod.rs b/xpallets/dex/spot/src/execution/mod.rs
index b05b20cf6..ceee67dbb 100644
--- a/xpallets/dex/spot/src/execution/mod.rs
+++ b/xpallets/dex/spot/src/execution/mod.rs
@@ -4,9 +4,10 @@ mod asset;
 mod order;
 mod state;
 
+use xp_logging::debug;
+
 use super::*;
 use crate::types::*;
-use xpallet_support::debug;
 
 impl<T: Trait> Module<T> {
     fn check_bid_price(
@@ -15,7 +16,7 @@ impl<T: Trait> Module<T> {
         fluctuation: T::Price,
     ) -> result::Result<(), Error<T>> {
         debug!(
-            "[check_bid_price]quote: {:?}, lowest_ask: {:?}, fluctuation: {:?}",
+            "[check_bid_price] quote: {:?}, lowest_ask: {:?}, fluctuation: {:?}",
             quote, lowest_ask, fluctuation
         );
 
diff --git a/xpallets/dex/spot/src/execution/order.rs b/xpallets/dex/spot/src/execution/order.rs
index 663672f43..6b4ebf8b9 100644
--- a/xpallets/dex/spot/src/execution/order.rs
+++ b/xpallets/dex/spot/src/execution/order.rs
@@ -66,7 +66,7 @@ impl<T: Trait> Module<T> {
             pair_id, price, order_id, submitter, order_type, side, amount, remaining,
         );
 
-        debug!("[inject_order]a new order injected:{:?}", order);
+        debug!("[inject_order] New order:{:?}", order);
         <OrderInfoOf<T>>::insert(&who, order_id, &order);
 
         // The order count of user should be increased after a new order is created.
diff --git a/xpallets/dex/spot/src/execution/state.rs b/xpallets/dex/spot/src/execution/state.rs
index 40f166de9..a0e497bf1 100644
--- a/xpallets/dex/spot/src/execution/state.rs
+++ b/xpallets/dex/spot/src/execution/state.rs
@@ -82,7 +82,7 @@ impl<T: Trait> Module<T> {
                 if new_highest_bid >= handicap.lowest_ask {
                     handicap.lowest_ask = Self::tick_up(new_highest_bid, pair.tick());
                     debug!(
-                        "[update_handicap]pair_id: {:?}, lowest_ask: {:?}, side: {:?}",
+                        "[update_handicap] pair_id: {:?}, lowest_ask: {:?}, side: {:?}",
                         order.pair_id(),
                         handicap.lowest_ask,
                         Side::Sell,
@@ -91,7 +91,7 @@ impl<T: Trait> Module<T> {
 
                 handicap.highest_bid = new_highest_bid;
                 debug!(
-                    "[update_handicap]pair_id: {:?}, highest_bid: {:?}, side: {:?}",
+                    "[update_handicap] pair_id: {:?}, highest_bid: {:?}, side: {:?}",
                     order.pair_id(),
                     new_highest_bid,
                     Side::Buy
@@ -110,7 +110,7 @@ impl<T: Trait> Module<T> {
                 if new_lowest_ask <= handicap.highest_bid {
                     handicap.highest_bid = Self::tick_down(new_lowest_ask, pair.tick());
                     debug!(
-                        "[update_handicap]pair_id: {:?}, highest_bid: {:?}, side: {:?}",
+                        "[update_handicap] pair_id: {:?}, highest_bid: {:?}, side: {:?}",
                         order.pair_id(),
                         handicap.highest_bid,
                         Side::Buy
@@ -119,7 +119,7 @@ impl<T: Trait> Module<T> {
 
                 handicap.lowest_ask = new_lowest_ask;
                 debug!(
-                    "[update_handicap]pair_id: {:?}, lowest_ask: {:?}, side: {:?}",
+                    "[update_handicap] pair_id: {:?}, lowest_ask: {:?}, side: {:?}",
                     order.pair_id(),
                     new_lowest_ask,
                     Side::Sell,
diff --git a/xpallets/dex/spot/src/lib.rs b/xpallets/dex/spot/src/lib.rs
index 523851ca2..a25c55f74 100644
--- a/xpallets/dex/spot/src/lib.rs
+++ b/xpallets/dex/spot/src/lib.rs
@@ -36,8 +36,8 @@ use frame_support::{
 use frame_system::{ensure_root, ensure_signed};
 
 use chainx_primitives::AssetId;
+use xp_logging::info;
 use xpallet_assets::AssetErr;
-use xpallet_support::info;
 
 pub use rpc::*;
 pub use types::*;
@@ -289,7 +289,7 @@ decl_module! {
         #[weight = <T as Trait>::WeightInfo::set_handicap()]
         fn set_handicap(origin, #[compact] pair_id: TradingPairId, new: Handicap< T::Price>) {
             ensure_root(origin)?;
-            info!("[set_handicap]pair_id:{:?},new handicap:{:?}", pair_id, new);
+            info!("[set_handicap] pair_id:{:?}, new handicap:{:?}", pair_id, new);
             HandicapOf::<T>::insert(pair_id, new);
         }
 
@@ -388,7 +388,7 @@ impl<T: Trait> Module<T> {
             tradable,
         };
 
-        info!("new trading pair: {:?}", pair);
+        info!("New trading pair: {:?}", pair);
 
         TradingPairOf::insert(pair_id, &pair);
         TradingPairInfoOf::<T>::insert(
@@ -406,7 +406,7 @@ impl<T: Trait> Module<T> {
 
     fn apply_update_trading_pair(pair_id: TradingPairId, tick_decimals: u32, tradable: bool) {
         info!(
-            "[update_trading_pair]pair_id: {:}, tick_decimals: {:}, tradable:{:}",
+            "[update_trading_pair] pair_id: {:}, tick_decimals: {:}, tradable:{:}",
             pair_id, tick_decimals, tradable
         );
         TradingPairOf::mutate(pair_id, |pair| {
@@ -473,7 +473,7 @@ impl<T: Trait> Module<T> {
         order_id: OrderId,
     ) -> DispatchResult {
         info!(
-            "[apply_cancel_order]who:{:?}, pair_id:{}, order_id:{}",
+            "[apply_cancel_order] who:{:?}, pair_id:{}, order_id:{}",
             who, pair_id, order_id
         );
 
diff --git a/xpallets/gateway/bitcoin/Cargo.toml b/xpallets/gateway/bitcoin/Cargo.toml
index 86a752b24..08b90e1db 100644
--- a/xpallets/gateway/bitcoin/Cargo.toml
+++ b/xpallets/gateway/bitcoin/Cargo.toml
@@ -26,7 +26,7 @@ orml-utilities = { version = "0.3", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
-xp-io = { path = "../../../primitives/io", default-features = false }
+xp-logging = { path = "../../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../../primitives/protocol", default-features = false }
 
 # ChainX pallets
@@ -65,7 +65,7 @@ std = [
     "orml-utilities/std",
     # ChainX primitives
     "chainx-primitives/std",
-    "xp-io/std",
+    "xp-logging/std",
     "xp-protocol/std",
     # ChainX pallets
     "xpallet-assets/std",
diff --git a/xpallets/gateway/bitcoin/src/header/header_proof.rs b/xpallets/gateway/bitcoin/src/header/header_proof.rs
index 11545848c..900e1fd21 100644
--- a/xpallets/gateway/bitcoin/src/header/header_proof.rs
+++ b/xpallets/gateway/bitcoin/src/header/header_proof.rs
@@ -5,7 +5,7 @@ use frame_support::{dispatch::DispatchResult, traits::UnixTime};
 use sp_std::{cmp, convert::TryFrom, result};
 
 // ChainX
-use xpallet_support::{debug, ensure_with_errorlog, error, info, warn};
+use xp_logging::{debug, error, info, warn};
 
 // light-bitcoin
 use light_bitcoin::{
@@ -67,14 +67,13 @@ impl<'a> HeaderWork<'a> {
     fn check<T: Trait>(&self, p: &BtcParams) -> DispatchResult {
         let previous_header_hash = self.info.header.previous_header_hash;
         let work = work_required::<T>(previous_header_hash, self.info.height, p);
-        ensure_with_errorlog!(
-            work == self.info.header.bits,
-            Error::<T>::HeaderNBitsNotMatch,
-            "nBits do not match difficulty rules|work{:?}|header bits:{:?}|height:{:}",
-            work,
-            self.info.header.bits,
-            self.info.height
-        );
+        if work != self.info.header.bits {
+            error!(
+                "[check_header_work] nBits do not match difficulty rules, work:{:?}, header bits:{:?}, height:{}",
+                work, self.info.header.bits, self.info.height
+            );
+            return Err(Error::<T>::HeaderNBitsNotMatch.into());
+        }
         Ok(())
     }
 }
@@ -89,11 +88,14 @@ pub fn work_required<T: Trait>(parent_hash: H256, height: u32, params: &BtcParam
 
     if is_retarget_height(height, params) {
         let new_work = work_required_retarget::<T>(parent_header, height, params);
-        info!("[work_required]|retaget new work required|height:{:}|retargeting_interval:{:}|new_work:{:?}", height, params.retargeting_interval(), new_work);
+        info!(
+            "[work_required] Retarget new work required, height:{}, retargeting_interval:{}, new_work:{:?}",
+            height, params.retargeting_interval(), new_work
+        );
         return new_work;
     }
     debug!(
-        "[work_required]|use old work requrie|old bits:{:?}",
+        "[work_required] Use old work required, old bits:{:?}",
         parent_header.bits
     );
     parent_header.bits
@@ -146,7 +148,7 @@ pub fn work_required_retarget<T: Trait>(
     retarget /= U256::from(params.target_timespan_seconds());
 
     debug!(
-        "[work_required_retarget]|retarget:{:}|maximum:{:?}",
+        "[work_required_retarget] retarget:{}, maximum:{:?}",
         retarget, maximum
     );
 
@@ -230,14 +232,22 @@ impl<'a> HeaderTimestamp<'a> {
     fn check<T: Trait>(&self, p: &BtcParams) -> DispatchResult {
         if let Some(current_time) = self.current_time {
             if self.header.time > current_time + p.block_max_future() {
-                error!("[HeaderTimestamp check]|Futuristic timestamp|header time{:}|current time:{:}|max_future{:?}", self.header.time, current_time, p.block_max_future());
+                error!(
+                    "[check_header_timestamp] Header time:{}, current time:{}, max_future{:?}",
+                    self.header.time,
+                    current_time,
+                    p.block_max_future()
+                );
                 Err(Error::<T>::HeaderFuturisticTimestamp.into())
             } else {
                 Ok(())
             }
         } else {
             // if get chain timestamp error, just ignore blockhead time check
-            warn!("[check_btc_header_time]|do not get timestamp or calculate timestamp error, ignore check|hash:{:?}", self.header.hash());
+            warn!(
+                "[check_header_timestamp] Header:{:?}, get unix timestamp error, ignore it",
+                self.header.hash()
+            );
             Ok(())
         }
     }
diff --git a/xpallets/gateway/bitcoin/src/header/mod.rs b/xpallets/gateway/bitcoin/src/header/mod.rs
index c76400889..607281a4c 100644
--- a/xpallets/gateway/bitcoin/src/header/mod.rs
+++ b/xpallets/gateway/bitcoin/src/header/mod.rs
@@ -8,7 +8,7 @@ use sp_runtime::DispatchResult;
 use sp_std::{cmp::Ordering, prelude::*};
 
 // ChainX
-use xpallet_support::{error, info};
+use xp_logging::{error, info};
 
 // light-bitcoin
 use light_bitcoin::primitives::H256;
@@ -63,7 +63,7 @@ fn look_back_confirmed_header<T: Trait>(
         height: header_info.height,
     });
     // e.g. when confirmations is 4, loop 3 times max
-    for _i in 1..confirmations {
+    for i in 1..confirmations {
         if let Some(current_info) = Module::<T>::headers(&prev_hash) {
             chain.push(BtcHeaderIndex {
                 hash: prev_hash,
@@ -73,8 +73,8 @@ fn look_back_confirmed_header<T: Trait>(
         } else {
             // if not find current header info, should be exceed genesis height, jump out of loop
             info!(
-                "[update_confirmed_header]|not find for hash:{:?}, current reverse count:{:}",
-                prev_hash, _i
+                "[update_confirmed_header] Can not find header ({:?}), current reverse count:{}",
+                prev_hash, i
             );
             break;
         }
@@ -150,7 +150,10 @@ pub fn check_confirmed_header<T: Trait>(header_info: &BtcHeaderInfo) -> Dispatch
                 Ordering::Less => {
                     // normal should not happen, for call `check_confirmed_header` should under
                     // current <= best
-                    error!("[check_confirmed_header]|should not happen, current confirmed is less than confirmed for this header|current:{:?}|now:{:?}", current_confirmed, now_confirmed);
+                    error!(
+                        "[check_confirmed_header] Should not happen, current confirmed is less than confirmed for this header, \
+                        current:{:?}, now:{:?}", current_confirmed, now_confirmed
+                    );
                     Err(Error::<T>::AncientFork.into())
                 }
             };
diff --git a/xpallets/gateway/bitcoin/src/lib.rs b/xpallets/gateway/bitcoin/src/lib.rs
index 83c92883c..87169b125 100644
--- a/xpallets/gateway/bitcoin/src/lib.rs
+++ b/xpallets/gateway/bitcoin/src/lib.rs
@@ -30,12 +30,13 @@ use orml_utilities::with_transaction_result;
 
 // ChainX
 use chainx_primitives::AssetId;
+use xp_logging::{debug, error, info};
 use xpallet_assets::{BalanceOf, Chain, ChainT, WithdrawalLimit};
 use xpallet_gateway_common::{
     traits::{AddrBinding, ChannelBinding, Extractable, TrusteeSession},
     trustees::bitcoin::BtcTrusteeAddrInfo,
 };
-use xpallet_support::{debug, ensure_with_errorlog, error, info, str, try_addr};
+use xpallet_support::{str, try_addr};
 
 // light-bitcoin
 #[cfg(feature = "std")]
@@ -65,7 +66,7 @@ use crate::weight_info::WeightInfo;
 macro_rules! native {
     ($level:tt, $patter:expr $(, $values:expr)* $(,)?) => {
         frame_support::debug::native::$level!(
-            target: xpallet_support::RUNTIME_TARGET,
+            target: xp_logging::RUNTIME_TARGET,
             $patter $(, $values)*
         )
     };
@@ -249,7 +250,7 @@ decl_storage! {
             #[cfg(not(test))] {
             if let BtcNetwork::Mainnet = config.network_id {
                 if genesis_index.height % config.params_info.retargeting_interval() != 0 {
-                    panic!("the blocknumber[{:}] should start from a changed difficulty block", genesis_index.height);
+                    panic!("Block #{} should start from a changed difficulty block", genesis_index.height);
                 }
             }
             }
@@ -275,9 +276,9 @@ decl_module! {
         /// if use `BtcHeader` struct would export in metadata, cause complex in front-end
         #[weight = <T as Trait>::WeightInfo::push_header()]
         pub fn push_header(origin, header: Vec<u8>) -> DispatchResultWithPostInfo {
-            let _from = ensure_signed(origin)?;
+            let from = ensure_signed(origin)?;
             let header: BtcHeader = deserialize(header.as_slice()).map_err(|_| Error::<T>::DeserializeErr)?;
-            debug!("[push_header]|from:{:?}|header:{:?}", _from, header);
+            debug!("[push_header] from:{:?}, header:{:?}", from, header);
 
             Self::apply_push_header(header)?;
 
@@ -304,7 +305,7 @@ decl_module! {
                 None
             };
             let relay_tx = relayed_info.into_relayed_tx(raw_tx);
-            native!(debug, "[push_transaction]|from:{:?}|relay_tx:{:?}|prev:{:?}", _from, relay_tx, prev);
+            native!(debug, "[push_transaction] from:{:?}, relay_tx:{:?}, prev:{:?}", _from, relay_tx, prev);
 
             Self::apply_push_transaction(relay_tx, prev)?;
 
@@ -325,10 +326,7 @@ decl_module! {
             Self::ensure_trustee(&from)?;
 
             let tx = Self::deserialize_tx(tx.as_slice())?;
-            native!(
-                debug,
-                "[create_withdraw_tx]|from:{:?}|withdrawal list:{:?}|tx:{:?}", from, withdrawal_id_list, tx
-            );
+            native!(debug, "[create_withdraw_tx] from:{:?}, withdrawal list:{:?}, tx:{:?}", from, withdrawal_id_list, tx);
 
             Self::apply_create_withdraw(from, tx, withdrawal_id_list)?;
             Ok(())
@@ -347,7 +345,7 @@ decl_module! {
             } else {
                 None
             };
-            native!(debug, "[sign_withdraw_tx]|from:{:?}|vote_tx:{:?}", from, tx);
+            native!(debug, "[sign_withdraw_tx] from:{:?}, vote_tx:{:?}", from, tx);
 
             Self::apply_sig_withdraw(from, tx)?;
             Ok(())
@@ -379,7 +377,7 @@ decl_module! {
             if let Some(w) = who {
                 remove_pending_deposit::<T>(&addr, &w);
             } else {
-                info!("[remove_pending]|release pending deposit directly, not deposit to someone|addr:{:?}", str!(&addr));
+                info!("[remove_pending] Release pending deposit directly, not deposit to someone, addr:{:?}", str!(&addr));
                 PendingDeposits::remove(&addr);
             }
             Ok(())
@@ -404,7 +402,7 @@ decl_module! {
         pub fn force_replace_proposal_tx(origin, tx: Vec<u8>) -> DispatchResult {
             T::TrusteeOrigin::try_origin(origin).map(|_| ()).or_else(ensure_root)?;
             let tx = Self::deserialize_tx(tx.as_slice())?;
-            native!(debug, "[force_replace_proposal_tx]|new_tx:{:?}", tx);
+            native!(debug, "[force_replace_proposal_tx] new_tx:{:?}", tx);
             Self::force_replace_withdraw_tx(tx)
         }
 
@@ -435,12 +433,13 @@ impl<T: Trait> ChainT<BalanceOf<T>> for Module<T> {
 
     fn check_addr(addr: &[u8], _: &[u8]) -> DispatchResult {
         // this addr is base58 addr
-        let address = Self::verify_btc_address(addr).map_err(|e| {
+        let address = Self::verify_btc_address(addr).map_err(|err| {
             error!(
-                "[verify_btc_address]|failed, source addr is:{:?}",
+                "[verify_btc_address] Verify failed, error:{:?}, source addr:{:?}",
+                err,
                 try_addr!(addr)
             );
-            e
+            err
         })?;
 
         match get_trustee_address_pair::<T>() {
@@ -450,8 +449,8 @@ impl<T: Trait> ChainT<BalanceOf<T>> for Module<T> {
                     return Err(Error::<T>::InvalidAddress.into());
                 }
             }
-            Err(e) => {
-                error!("[check_addr]|not get trustee addr|err:{:?}", e);
+            Err(err) => {
+                error!("[check_addr] Can not get trustee addr:{:?}", err);
             }
         }
 
@@ -490,17 +489,18 @@ impl<T: Trait> Module<T> {
 
     fn apply_push_header(header: BtcHeader) -> DispatchResult {
         // current should not exist
-        ensure_with_errorlog!(
-            Self::headers(&header.hash()).is_none(),
-            Error::<T>::ExistingHeader,
-            "Header already exists|hash:{:}",
-            header.hash(),
-        );
+        if Self::headers(&header.hash()).is_some() {
+            error!(
+                "[apply_push_header] The BTC header already exists, hash:{:?}",
+                header.hash()
+            );
+            return Err(Error::<T>::ExistingHeader.into());
+        }
         // prev header should exist, thus we reject orphan block
         let prev_info = Self::headers(header.previous_header_hash).ok_or_else(|| {
             native!(
                 error,
-                "[check_prev_and_convert]|not find prev header|current header:{:?}",
+                "[check_prev_and_convert] Can not find prev header, current header:{:?}",
                 header
             );
             Error::<T>::PrevHeaderNotExisted
@@ -528,10 +528,11 @@ impl<T: Trait> Module<T> {
                 }
             });
 
-            debug!("[apply_push_header]|verify pass, insert to storage|height:{:}|hash:{:?}|block hashs for this height:{:?}",
-                   header_info.height,
-                   hash,
-                   Self::block_hash_for(header_info.height)
+            debug!(
+                "[apply_push_header] Verify successfully, insert header to storage [height:{}, hash:{:?}, all hashes of the height:{:?}]",
+                header_info.height,
+                hash,
+                Self::block_hash_for(header_info.height)
             );
 
             let best_index = Self::best_index();
@@ -545,14 +546,17 @@ impl<T: Trait> Module<T> {
                 // note update_confirmed_header would mutate other storage depend on BlockHashFor
                 let confirmed_index = header::update_confirmed_header::<T>(&header_info);
                 info!(
-                    "[apply_push_header]|update to new height|height:{:}|hash:{:?}|confirm:{:?}",
+                    "[apply_push_header] Update new height:{}, hash:{:?}, confirm:{:?}",
                     header_info.height, hash, confirmed_index
                 );
                 // change new best index
                 BestIndex::put(new_best_index);
             } else {
                 // forked chain
-                info!("[apply_push_header]|best index larger than this height|best height:{:}|this height{:}", best_index.height, header_info.height);
+                info!(
+                    "[apply_push_header] Best index {} larger than this height {}",
+                    best_index.height, header_info.height
+                );
                 header::check_confirmed_header::<T>(&header_info)?;
             };
             Self::deposit_event(Event::<T>::HeaderInserted(hash));
@@ -565,10 +569,10 @@ impl<T: Trait> Module<T> {
         let block_hash = tx.block_hash;
         let header_info = Module::<T>::headers(&tx.block_hash).ok_or_else(|| {
             error!(
-                "[apply_push_transaction]|tx's block header must exist before|block_hash:{:}",
+                "[apply_push_transaction] Tx's block header ({:?}) must exist before",
                 block_hash
             );
-            "tx's block header must already exist"
+            "Tx's block header must already exist"
         })?;
         let merkle_root = header_info.header.merkle_root_hash;
         // verify, check merkle proof
@@ -582,7 +586,10 @@ impl<T: Trait> Module<T> {
         let confirmed = Self::confirmed_index().ok_or(Error::<T>::UnconfirmedTx)?;
         let height = header_info.height;
         if height > confirmed.height {
-            error!("[apply_push_transaction]|receive an unconfirmed tx|tx hash:{:}|related block height:{:}|confirmed block height:{:}|hash:{:?}", tx_hash, height, confirmed.height, confirmed.hash);
+            error!(
+                "[apply_push_transaction] Receive an unconfirmed tx (height:{}, hash:{:?}), confirmed index (height:{}, hash:{:?})", 
+                height, tx_hash, confirmed.height, confirmed.hash
+            );
             return Err(Error::<T>::UnconfirmedTx.into());
         }
         // check whether replayed tx has been processed, just process failed and not processed tx;
@@ -590,7 +597,10 @@ impl<T: Trait> Module<T> {
             None => { /* do nothing */ }
             Some(state) => {
                 if state.result == BtcTxResult::Success {
-                    error!("[apply_push_transaction]|reject processed tx|tx hash:{:}|type:{:?}|result:{:?}", tx_hash, state.tx_type, state.result);
+                    error!(
+                        "[apply_push_transaction] Reject processed tx (hash:{:?}, type:{:?}, result:{:?})", 
+                        tx_hash, state.tx_type, state.result
+                    );
                     return Err(Error::<T>::ReplayedTx.into());
                 }
             }
diff --git a/xpallets/gateway/bitcoin/src/trustee.rs b/xpallets/gateway/bitcoin/src/trustee.rs
index a04c920ea..5139ca874 100644
--- a/xpallets/gateway/bitcoin/src/trustee.rs
+++ b/xpallets/gateway/bitcoin/src/trustee.rs
@@ -16,6 +16,7 @@ use light_bitcoin::{
     script::{Builder, Opcode, Script},
 };
 
+use xp_logging::{debug, error, info};
 use xpallet_assets::Chain;
 use xpallet_gateway_common::{
     traits::{TrusteeForChain, TrusteeSession},
@@ -23,7 +24,6 @@ use xpallet_gateway_common::{
     types::{TrusteeInfoConfig, TrusteeIntentionProps, TrusteeSessionInfo},
     utils::two_thirds_unsafe,
 };
-use xpallet_support::{debug, error, info};
 
 use crate::tx::utils::{addr2vecu8, ensure_identical, parse_output_addr};
 use crate::tx::validator::parse_and_check_signed_tx;
@@ -78,7 +78,7 @@ pub fn get_hot_trustee_redeem_script<T: Trait>() -> Result<Script, DispatchError
 fn check_keys<T: Trait>(keys: &[Public]) -> DispatchResult {
     let has_duplicate = (1..keys.len()).any(|i| keys[i..].contains(&keys[i - 1]));
     if has_duplicate {
-        error!("[generate_new_trustees]|keys contains duplicate pubkey");
+        error!("[generate_new_trustees] Keys contains duplicate pubkey");
         return Err(Error::<T>::DuplicatedKeys.into());
     }
     let has_normal_pubkey = keys.iter().any(|public: &Public| {
@@ -89,7 +89,7 @@ fn check_keys<T: Trait>(keys: &[Public]) -> DispatchResult {
         }
     });
     if has_normal_pubkey {
-        return Err("unexpect! all keys(bitcoin Public) should be compressed".into());
+        return Err("Unexpect! All keys(bitcoin Public) should be compressed".into());
     }
     Ok(())
 }
@@ -108,22 +108,22 @@ impl<T: Trait> TrusteeForChain<T::AccountId, BtcTrusteeType, BtcTrusteeAddrInfo>
             .map_err(|_| Error::<T>::InvalidPublicKey)?;
         let public = trustee_type.0;
         if let Public::Normal(_) = public {
-            error!("not allow Normal Public for bitcoin now");
+            error!("Disallow Normal Public for bitcoin now");
             return Err(Error::<T>::InvalidPublicKey.into());
         }
 
         if 2 != raw_addr[0] && 3 != raw_addr[0] {
-            error!("not Compressed Public(prefix not 2|3)");
+            error!("Not Compressed Public(prefix not 2|3)");
             return Err(Error::<T>::InvalidPublicKey.into());
         }
 
         if ZERO_P == raw_addr[1..33] {
-            error!("not Compressed Public(Zero32)");
+            error!("Not Compressed Public(Zero32)");
             return Err(Error::<T>::InvalidPublicKey.into());
         }
 
         if &raw_addr[1..33] >= &EC_P {
-            error!("not Compressed Public(EC_P)");
+            error!("Not Compressed Public(EC_P)");
             return Err(Error::<T>::InvalidPublicKey.into());
         }
 
@@ -153,8 +153,11 @@ impl<T: Trait> TrusteeForChain<T::AccountId, BtcTrusteeType, BtcTrusteeAddrInfo>
         if (trustees.len() as u32) < config.min_trustee_count
             || (trustees.len() as u32) > config.max_trustee_count
         {
-            error!("[generate_trustee_session_info]|trustees is less/more than {{min:[{:}], max:[{:}]}} people, can't generate trustee addr|trustees:{:?}",
-                   config.min_trustee_count, config.max_trustee_count, trustees);
+            error!(
+                "[generate_trustee_session_info] Trustees {:?} is less/more than {{min:{}, max:{}}} people, \
+                can't generate trustee addr",
+                trustees, config.min_trustee_count, config.max_trustee_count
+            );
             return Err(Error::<T>::InvalidTrusteeCount.into());
         }
 
@@ -167,14 +170,14 @@ impl<T: Trait> TrusteeForChain<T::AccountId, BtcTrusteeType, BtcTrusteeAddrInfo>
         };
         #[cfg(feature = "std")]
         info!(
-            "[generate_trustee_session_info]|hot_keys:[{}]|cold_keys:[{}]",
+            "[generate_trustee_session_info] hot_keys:[{}], cold_keys:[{}]",
             pretty_print_keys(&hot_keys),
             pretty_print_keys(&cold_keys)
         );
 
         #[cfg(not(feature = "std"))]
         info!(
-            "[generate_trustee_session_info]|hot_keys:{:?}|cold_keys:{:?}",
+            "[generate_trustee_session_info] hot_keys:{:?}, cold_keys:{:?}",
             hot_keys, cold_keys
         );
 
@@ -183,7 +186,7 @@ impl<T: Trait> TrusteeForChain<T::AccountId, BtcTrusteeType, BtcTrusteeAddrInfo>
         let hot_trustee_addr_info: BtcTrusteeAddrInfo =
             create_multi_address::<T>(&hot_keys, sig_num).ok_or_else(|| {
                 error!(
-                    "[generate_trustee_session_info]|create hot_addr err!|hot_keys:{:?}",
+                    "[generate_trustee_session_info] Create hot_addr error, hot_keys:{:?}",
                     hot_keys
                 );
                 Error::<T>::GenerateMultisigFailed
@@ -192,15 +195,15 @@ impl<T: Trait> TrusteeForChain<T::AccountId, BtcTrusteeType, BtcTrusteeAddrInfo>
         let cold_trustee_addr_info: BtcTrusteeAddrInfo =
             create_multi_address::<T>(&cold_keys, sig_num).ok_or_else(|| {
                 error!(
-                    "[generate_trustee_session_info]|create cold_addr err!|cold_keys:{:?}",
+                    "[generate_trustee_session_info] Create cold_addr error, cold_keys:{:?}",
                     cold_keys
                 );
                 Error::<T>::GenerateMultisigFailed
             })?;
 
         native::info!(
-            target: xpallet_support::RUNTIME_TARGET,
-            "[generate_trustee_session_info]|hot_addr:{:?}|cold_addr:{:?}|trustee_list:{:?}",
+            target: xp_logging::RUNTIME_TARGET,
+            "[generate_trustee_session_info] hot_addr:{:?}, cold_addr:{:?}, trustee_list:{:?}",
             hot_trustee_addr_info,
             cold_trustee_addr_info,
             trustees
@@ -222,7 +225,7 @@ impl<T: Trait> Module<T> {
             Ok(())
         } else {
             error!(
-                "[ensure_trustee]|Committer not in the trustee list!|who:{:?}|trustees:{:?}",
+                "[ensure_trustee] Committer {:?} not in the trustee list:{:?}",
                 who, trustee_session_info.trustee_list
             );
             Err(Error::<T>::NotTrustee.into())
@@ -236,7 +239,10 @@ impl<T: Trait> Module<T> {
     ) -> DispatchResult {
         let withdraw_amount = Self::max_withdrawal_count();
         if withdrawal_id_list.len() > withdraw_amount as usize {
-            error!("[apply_create_withdraw]|Exceeding the maximum withdrawal amount|current list len:{:}|max:{:}", withdrawal_id_list.len(), withdraw_amount);
+            error!(
+                "[apply_create_withdraw] Current list (len:{}) exceeding the max withdrawal amount {}",
+                withdrawal_id_list.len(), withdraw_amount
+            );
             return Err(Error::<T>::WroungWithdrawalCount.into());
         }
         // remove duplicate
@@ -246,7 +252,7 @@ impl<T: Trait> Module<T> {
 
         check_withdraw_tx::<T>(&tx, &withdrawal_id_list)?;
         info!(
-            "[apply_create_withdraw]|create new withdraw|withdrawal idlist:{:?}",
+            "[apply_create_withdraw] Create new withdraw, id_list:{:?}",
             withdrawal_id_list
         );
 
@@ -257,7 +263,10 @@ impl<T: Trait> Module<T> {
         } else if sigs_count == 1 {
             true
         } else {
-            error!("[apply_create_withdraw]|the sigs for tx could not more than 1 in apply_create_withdraw|current sigs:{:}", sigs_count);
+            error!(
+                "[apply_create_withdraw] The sigs for tx could not more than 1, current sigs:{}",
+                sigs_count
+            );
             return Err(Error::<T>::InvalidSignCount.into());
         };
 
@@ -273,7 +282,7 @@ impl<T: Trait> Module<T> {
             Vec::new(),
         );
 
-        info!("[apply_create_withdraw]|Through the legality check of withdrawal");
+        info!("[apply_create_withdraw] Pass the legality check of withdrawal");
 
         Self::deposit_event(Event::<T>::WithdrawalProposalCreated(
             who.clone(),
@@ -281,7 +290,7 @@ impl<T: Trait> Module<T> {
         ));
 
         if apply_sig {
-            info!("[apply_create_withdraw]apply sign after create proposal");
+            info!("[apply_create_withdraw] Apply sign after creating proposal");
             // due to `SignWithdrawalProposal` event should after `WithdrawalProposalCreated`, thus this function should after proposal
             // but this function would have an error return, this error return should not meet.
             if insert_trustee_vote_state::<T>(true, &who, &mut proposal.trustee_list).is_err() {
@@ -301,7 +310,7 @@ impl<T: Trait> Module<T> {
             Self::withdrawal_proposal().ok_or(Error::<T>::NoProposal)?;
 
         if proposal.sig_state == VoteResult::Finish {
-            error!("[apply_sig_withdraw]|proposal is on FINISH state, can't sign for this proposal|proposal：{:?}", proposal);
+            error!("[apply_sig_withdraw] Proposal is on FINISH state, can't sign for this proposal:{:?}", proposal);
             return Err(Error::<T>::RejectSig.into());
         }
 
@@ -315,7 +324,7 @@ impl<T: Trait> Module<T> {
                 // check first and get signatures from commit transaction
                 let sigs_count = parse_and_check_signed_tx::<T>(&tx)?;
                 if sigs_count == 0 {
-                    error!("[apply_sig_withdraw]|the tx sig should not be zero, zero is the source tx without any sig|tx{:?}", tx);
+                    error!("[apply_sig_withdraw] Tx sig should not be zero, zero is the source tx without any sig, tx{:?}", tx);
                     return Err(Error::<T>::InvalidSignCount.into());
                 }
 
@@ -327,9 +336,8 @@ impl<T: Trait> Module<T> {
 
                 if sigs_count != confirmed_count + 1 {
                     error!(
-                        "[apply_sig_withdraw]|Need to sign on the latest signature results|sigs count:{:}|confirmed count:{:}",
-                        sigs_count,
-                        confirmed_count
+                        "[apply_sig_withdraw] Need to sign on the latest signature results, sigs count:{}, confirmed count:{}",
+                        sigs_count, confirmed_count
                     );
                     return Err(Error::<T>::InvalidSignCount.into());
                 }
@@ -340,7 +348,7 @@ impl<T: Trait> Module<T> {
                 // e.g. total=6 => required=2*6/3=4, thus equal to 4 should mark as finish
                 if sigs_count == sig_num {
                     // mark as finish, can't do anything for this proposal
-                    info!("[apply_sig_withdraw]Signature completed: {:}", sigs_count);
+                    info!("[apply_sig_withdraw] Signature completed:{}", sigs_count);
                     proposal.sig_state = VoteResult::Finish;
 
                     Self::deposit_event(Event::<T>::WithdrawalProposalCompleted(tx.hash()))
@@ -366,7 +374,7 @@ impl<T: Trait> Module<T> {
                 let need_reject = total - sig_num + 1;
                 if reject_count == need_reject {
                     info!(
-                        "[apply_sig_withdraw]|{:}/{:} opposition, clear withdrawal propoal",
+                        "[apply_sig_withdraw] {}/{} opposition, clear withdrawal proposal",
                         reject_count, total
                     );
 
@@ -391,7 +399,7 @@ impl<T: Trait> Module<T> {
         }
 
         info!(
-            "[apply_sig_withdraw]|current sig|state:{:?}|trustee vote:{:?}",
+            "[apply_sig_withdraw] Current sig state:{:?}, trustee vote:{:?}",
             proposal.sig_state, proposal.trustee_list
         );
 
@@ -449,7 +457,7 @@ pub(crate) fn create_multi_address<T: Trait>(
         panic!("required sig num should less than trustee_num; qed")
     }
     if sum > 15 {
-        error!("bitcoin's multisig can't more than 15, current is:{:}", sum);
+        error!("Bitcoin's multisig can't more than 15, current:{}", sum);
         return None;
     }
 
@@ -494,13 +502,13 @@ fn insert_trustee_vote_state<T: Trait>(
     match trustee_list.iter_mut().find(|ref info| info.0 == *who) {
         Some(_) => {
             // if account is exist, override state
-            error!("[inseRelayedTx_trustee_vote_state]|already vote for this withdrawal proposal|who:{:?}|old vote:{:}", who, state);
+            error!("[insert_trustee_vote_state] {:?} has already vote for this withdrawal proposal, old vote:{}", who, state);
             return Err("already vote for this withdrawal proposal".into());
         }
         None => {
             trustee_list.push((who.clone(), state));
             debug!(
-                "[inseRelayedTx_trustee_vote_state]|inseRelayedTx new vote|who:{:?}|state:{:}",
+                "[insert_trustee_vote_state] Insert new vote, who:{:?}, state:{}",
                 who, state
             );
         }
@@ -551,27 +559,36 @@ fn check_withdraw_tx_impl<T: Trait>(
 
     // appl_withdrawal_list must match to tx_withdraw_list
     if appl_withdrawal_list.len() != tx_withdraw_list.len() {
-        error!("withdrawal tx's outputs not equal to withdrawal application list, withdrawal application len:{:}, withdrawal tx's outputs len:{:}|withdrawal application list:{:?}, tx withdrawal outputs:{:?}",
-               appl_withdrawal_list.len(), tx_withdraw_list.len(),
-               withdrawal_id_list.iter().zip(appl_withdrawal_list).collect::<Vec<_>>(),
-               tx_withdraw_list
+        error!(
+            "Withdrawal tx's outputs (len:{}) != withdrawal application list (len:{}), \
+            withdrawal tx's outputs:{:?}, withdrawal application list:{:?}",
+            tx_withdraw_list.len(),
+            appl_withdrawal_list.len(),
+            tx_withdraw_list,
+            withdrawal_id_list
+                .iter()
+                .zip(appl_withdrawal_list)
+                .collect::<Vec<_>>()
         );
         return Err(Error::<T>::InvalidProposal.into());
     }
 
-    let count = appl_withdrawal_list.iter().zip(tx_withdraw_list).filter(|(a,b)|{
-        if a.0 == b.0 && a.1 == b.1 {
-            true
-        }
-        else {
-            error!(
-                "withdrawal tx's output not match to withdrawal application. withdrawal application :{:?}, tx withdrawal output:{:?}",
-                a,
-                b
-            );
-            false
-        }
-    }).count();
+    let count = appl_withdrawal_list
+        .iter()
+        .zip(tx_withdraw_list)
+        .filter(|(a, b)| {
+            if a.0 == b.0 && a.1 == b.1 {
+                true
+            } else {
+                error!(
+                    "Withdrawal tx's output not match to withdrawal application. \
+                    withdrawal application:{:?}, tx withdrawal output:{:?}",
+                    a, b
+                );
+                false
+            }
+        })
+        .count();
 
     if count != appl_withdrawal_list.len() {
         return Err(Error::<T>::InvalidProposal.into());
diff --git a/xpallets/gateway/bitcoin/src/tx/mod.rs b/xpallets/gateway/bitcoin/src/tx/mod.rs
index 01aac5350..54144908d 100644
--- a/xpallets/gateway/bitcoin/src/tx/mod.rs
+++ b/xpallets/gateway/bitcoin/src/tx/mod.rs
@@ -14,9 +14,10 @@ use sp_runtime::{traits::Zero, SaturatedConversion};
 use sp_std::{fmt::Debug, prelude::*, result};
 // ChainX
 use chainx_primitives::{AssetId, ReferralId};
+use xp_logging::{debug, error, info, warn};
 use xpallet_assets::ChainT;
 use xpallet_gateway_common::traits::{AddrBinding, ChannelBinding, Extractable};
-use xpallet_support::{debug, error, info, str, warn};
+use xpallet_support::str;
 
 // light-bitcoin
 use light_bitcoin::{
@@ -134,7 +135,7 @@ where
             }
             _ => {
                 warn!(
-                    "[detect_transaction_type_impl]|it's an irrelevance tx or deposit tx|tx_hash:{:?}",
+                    "[detect_transaction_type_impl] Irrelevance or Deposit transaction:{:?}",
                     tx.hash()
                 );
             }
@@ -176,7 +177,7 @@ where
         };
         MetaTxType::Deposit(info)
     } else {
-        warn!("[detect_deposit_type]|receive a deposit tx but deposit value is too low, dropped|tx:{:?}", tx.hash());
+        warn!("[detect_deposit_type] Receive a deposit tx ({:?}) but deposit value is too low, drop it", tx.hash());
         MetaTxType::Irrelevance
     }
 }
@@ -264,8 +265,8 @@ where
     }
 
     native::debug!(
-        target: xpallet_support::RUNTIME_TARGET,
-        "[parse_deposit_outputs_impl]|parse outputs|account_info:{:?}|balance:{:}|opreturn:{:}|",
+        target: xp_logging::RUNTIME_TARGET,
+        "[parse_deposit_outputs_impl] Parse outputs, account_info:{:?}, balance:{}, opreturn:{}",
         account_info,
         deposit_balance,
         trick_format_opreturn(&_original)
@@ -289,35 +290,41 @@ pub(crate) fn handle_tx<T: Trait>(
 
 fn deposit<T: Trait>(hash: H256, deposit_info: DepositInfo<T::AccountId>) -> BtcTxResult {
     if deposit_info.op_return.is_none() && deposit_info.input_addr.is_none() {
-        warn!("[deposit]|process a deposit tx but do not have valid opreturn & not have input addr|tx:{:?}", hash);
+        warn!("[deposit] Process a deposit tx ({:?}) but do not have valid opreturn & not have input addr", hash);
         return BtcTxResult::Failed;
     }
 
     let account_info = match deposit_info.op_return {
-        Some((accountid, channel_name)) => {
+        Some((account, referral)) => {
             if let Some(addr) = deposit_info.input_addr {
                 let addr = addr2vecu8(&addr);
                 // remove old unbinding deposit info
-                remove_pending_deposit::<T>(&addr, &accountid);
+                remove_pending_deposit::<T>(&addr, &account);
                 // update or override binding info
-                T::AddrBinding::update_binding(Module::<T>::chain(), addr, accountid.clone());
+                T::AddrBinding::update_binding(Module::<T>::chain(), addr, account.clone());
             } else {
                 // no input addr
-                debug!("[deposit]|no input addr for this deposit tx, but has opreturn to get accountid|tx_hash:{:?}|who:{:?}", hash, accountid);
+                debug!(
+                    "[deposit] Deposit tx ({:?}) has no input addr, but has opreturn, who:{:?}",
+                    hash, account
+                );
             }
-            AccountInfo::<T::AccountId>::Account((accountid, channel_name))
+            AccountInfo::<T::AccountId>::Account((account, referral))
         }
         None => {
             if let Some(addr) = deposit_info.input_addr {
                 // no opreturn, use addr to get accountid
                 let addr_bytes = addr2vecu8(&addr);
                 match T::AddrBinding::get_binding(Module::<T>::chain(), addr_bytes) {
-                    Some(accountid) => AccountInfo::Account((accountid, None)),
+                    Some(account) => AccountInfo::Account((account, None)),
                     None => AccountInfo::Address(addr),
                 }
             } else {
                 // should not meet this branch, due it's handled before, it's unreachable
-                error!("[deposit]|no input addr for this deposit tx, neither has opreturn to get accountid!|tx_hash:{:?}", hash);
+                error!(
+                    "[deposit] The deposit tx ({:?}) has no input addr and opreturn",
+                    hash
+                );
                 return BtcTxResult::Failed;
             }
         }
@@ -335,17 +342,17 @@ fn deposit<T: Trait>(hash: H256, deposit_info: DepositInfo<T::AccountId>) -> Btc
                 return BtcTxResult::Failed;
             }
             info!(
-                "[deposit]|deposit success|who:{:?}|balance:{:}|tx_hash:{:}",
-                accountid, deposit_info.deposit_value, hash
+                "[deposit] Deposit tx ({:?}) success, who:{:?}, balance:{}",
+                hash, accountid, deposit_info.deposit_value
             );
         }
         AccountInfo::<_>::Address(addr) => {
             insert_pending_deposit::<T>(&addr, &hash, deposit_info.deposit_value);
             info!(
-                "[deposit]|deposit into pending|addr:{:?}|balance:{:}|tx_hash:{:}",
+                "[deposit] Deposit tx ({:?}) into pending, addr:{:?}, balance:{}",
+                hash,
                 str!(addr2vecu8(&addr)),
-                deposit_info.deposit_value,
-                hash
+                deposit_info.deposit_value
             );
         }
     };
@@ -357,16 +364,16 @@ fn deposit_token<T: Trait>(tx_hash: H256, who: &T::AccountId, balance: u64) -> D
 
     let value: BalanceOf<T> = balance.saturated_into();
     match <xpallet_gateway_records::Module<T>>::deposit(&who, id, value) {
-        Ok(a) => {
+        Ok(()) => {
             Module::<T>::deposit_event(Event::<T>::Deposited(tx_hash, who.clone(), value));
-            Ok(a)
+            Ok(())
         }
-        Err(e) => {
+        Err(err) => {
             error!(
-                "[deposit_token]deposit error, must use root to fix this error. reason:{:?}",
-                e
+                "[deposit_token] Deposit error:{:?}, must use root to fix it",
+                err
             );
-            Err(e.into())
+            Err(err.into())
         }
     }
 }
@@ -408,7 +415,7 @@ pub fn remove_pending_deposit<T: Trait>(input_address: &BtcAddress, who: &T::Acc
         // ignore error
         let _ = deposit_token::<T>(r.txid, who, r.balance);
         info!(
-            "[remove_pending_deposit]|use pending info to re-deposit|who:{:?}|balance:{:}|cached_tx:{:?}",
+            "[remove_pending_deposit] Use pending info to re-deposit, who:{:?}, balance:{}, cached_tx:{:?}",
             who, r.balance, r.txid,
         );
 
@@ -432,8 +439,8 @@ fn insert_pending_deposit<T: Trait>(input_address: &Address, txid: &H256, balanc
     PendingDeposits::mutate(&addr_bytes, |list| {
         if !list.contains(&cache) {
             native::debug!(
-                target: xpallet_support::RUNTIME_TARGET,
-                "[insert_pending_deposit]|Add pending deposit|address:{:?}|txhash:{:}|balance:{:}",
+                target: xp_logging::RUNTIME_TARGET,
+                "[insert_pending_deposit] Add pending deposit, address:{:?}, txhash:{:?}, balance:{}",
                 str!(addr_bytes),
                 txid,
                 balance
@@ -448,8 +455,8 @@ fn insert_pending_deposit<T: Trait>(input_address: &Address, txid: &H256, balanc
 fn withdraw<T: Trait>(tx: Transaction) -> BtcTxResult {
     if let Some(proposal) = WithdrawalProposal::<T>::take() {
         native::debug!(
-            target: xpallet_support::RUNTIME_TARGET,
-            "[withdraw]|withdraw handle|proposal:{:?}|tx:{:?}",
+            target: xp_logging::RUNTIME_TARGET,
+            "[withdraw] Withdraw tx {:?}, proposal:{:?}",
             proposal,
             tx
         );
@@ -468,10 +475,13 @@ fn withdraw<T: Trait>(tx: Transaction) -> BtcTxResult {
 
                 match xpallet_gateway_records::Module::<T>::finish_withdrawal(*number, None) {
                     Ok(_) => {
-                        info!("[withdraw]|ID of withdrawal completion: {:}", *number);
+                        info!("[withdraw] Withdrawal ({}) completion", *number);
                     }
-                    Err(_e) => {
-                        error!("[withdraw]|ID of withdrawal ERROR! {:}, reason:{:?}, please use root to fix it", *number, _e);
+                    Err(err) => {
+                        error!(
+                            "[withdraw] Withdrawal ({}) error:{:?}, must use root to fix it",
+                            *number, err
+                        );
                     }
                 }
             }
@@ -487,8 +497,10 @@ fn withdraw<T: Trait>(tx: Transaction) -> BtcTxResult {
             ));
             BtcTxResult::Success
         } else {
-            error!("[withdraw]|Withdrawal failed, mismatch withdraw. please use root to fix it|withdrawal idlist:{:?}|proposal id:{:?}|tx hash:{:}",
-                   proposal.withdrawal_id_list, proposal_hash, tx_hash);
+            error!(
+                "[withdraw] Withdraw error: mismatch (tx_hash:{:?}, proposal_hash:{:?}), id_list:{:?}, must use root to fix it",
+                tx_hash, proposal_hash, proposal.withdrawal_id_list
+            );
             // re-store proposal into storage.
             WithdrawalProposal::<T>::put(proposal);
 
@@ -496,8 +508,10 @@ fn withdraw<T: Trait>(tx: Transaction) -> BtcTxResult {
             BtcTxResult::Failed
         }
     } else {
-        error!("[withdraw]|Withdrawal failed, the proposal is EMPTY, but receive a withdrawal tx, please use root to fix it|tx hash:{:}", tx.hash());
-
+        error!(
+            "[withdraw] Withdrawal error: proposal is EMPTY (tx_hash:{:?}), but receive a withdrawal tx, must use root to fix it",
+            tx.hash()
+        );
         // no proposal, but find a withdraw tx, it's a fatal error in withdrawal
         Module::<T>::deposit_event(Event::<T>::WithdrawalFatalErr(
             tx.hash(),
diff --git a/xpallets/gateway/bitcoin/src/tx/utils.rs b/xpallets/gateway/bitcoin/src/tx/utils.rs
index 7b28e4259..e359d238e 100644
--- a/xpallets/gateway/bitcoin/src/tx/utils.rs
+++ b/xpallets/gateway/bitcoin/src/tx/utils.rs
@@ -1,11 +1,12 @@
 // Copyright 2019-2020 ChainX Project Authors. Licensed under GPL-3.0.
 
 // Substrate
-use frame_support::dispatch::DispatchResult;
+use sp_runtime::DispatchResult;
 use sp_std::prelude::Vec;
 
 // ChainX
-use xpallet_support::{error, try_hex, warn};
+use xp_logging::{error, warn};
+use xpallet_support::try_hex;
 
 // light-bitcoin
 use light_bitcoin::{
@@ -23,13 +24,13 @@ pub fn parse_output_addr<T: Trait>(script: &Script) -> Option<Address> {
 
 pub fn parse_output_addr_with_networkid(script: &Script, network: Network) -> Option<Address> {
     // only `p2pk`, `p2pkh`, `p2sh` could parse
-    script.extract_destinations().map_err(|_e|{
+    script.extract_destinations().map_err(|err|{
         error!(
-            "[parse_output_addr]|parse output script error|e:{:}|script:{:?}",
-            _e,
+            "[parse_output_addr] Parse output script error:{}, script:{:?}",
+            err,
             try_hex!(&script)
         );
-        _e
+        err
     }).ok().and_then(|script_addresses| {
         // find addr in this transaction
         if script_addresses.len() == 1 {
@@ -42,7 +43,10 @@ pub fn parse_output_addr_with_networkid(script: &Script, network: Network) -> Op
             return Some(addr);
         }
         // the type is `NonStandard`, `Multisig`, `NullData`, `WitnessScript`, `WitnessKey`
-        warn!("[parse_output_addr]|can't parse addr from output script|type:{:?}|addr:{:?}|script:{:?}", script.script_type(), script_addresses, try_hex!(&script));
+        warn!(
+            "[parse_output_addr] Can not parse addr from output script, type:{:?}, addr:{:?}, script:{:?}",
+            script.script_type(), script_addresses, try_hex!(&script)
+        );
         None
     })
 }
@@ -84,7 +88,7 @@ pub fn parse_opreturn(script: &Script) -> Option<Vec<u8>> {
         // jump OP_RETURN, when after `is_null_data_script`, subscript must larger and equal than 1
         let s = script.subscript(1);
         if s.is_empty() {
-            error!("[parse_opreturn]|nothing after `OP_RETURN`, valid in rule but invalid for public consensus");
+            error!("[parse_opreturn] Nothing after `OP_RETURN`, valid in rule but invalid for public consensus");
             return None;
         }
         // script must large then 1
@@ -92,14 +96,18 @@ pub fn parse_opreturn(script: &Script) -> Option<Vec<u8>> {
             if s[0] as usize == (&s[1..]).len() {
                 Some(s[1..].to_vec())
             } else {
-                error!("[parse_opreturn]|unexpect! opreturn source error, len not equal to real len|len:{:?}|real:{:?}", s[0], &s[1..]);
+                error!(
+                    "[parse_opreturn] Unexpect opreturn source error, len:{}, real:{:?}",
+                    s[0],
+                    &s[1..]
+                );
                 None
             }
         } else if s[0] == Opcode::OP_PUSHDATA1 as u8 {
             // when subscript [0] is `OP_PUSHDATA1`, must have [1], or is an invalid data
             if s.len() < 2 {
                 error!(
-                    "[parse_opreturn]|nothing after `OP_PUSHDATA1`, invalid opreturn|{:?}",
+                    "[parse_opreturn] Nothing after `OP_PUSHDATA1`, invalid opreturn:{:?}",
                     s
                 );
                 return None;
@@ -108,11 +116,14 @@ pub fn parse_opreturn(script: &Script) -> Option<Vec<u8>> {
             if s[1] as usize == (&s[2..]).len() {
                 Some(s[2..].to_vec())
             } else {
-                error!("[parse_opreturn]|unexpect! opreturn source error, len not equal to real len|len mark:{:?}|len:{:?}|real:{:?}", s[0], s[1], &s[2..]);
+                error!(
+                    "[parse_opreturn] Unexpect opreturn source error, len mark:{:?}, len:{:?}, real:{:?}",
+                    s[0], s[1], &s[2..]
+                );
                 None
             }
         } else {
-            error!("[parse_opreturn]|unexpect! opreturn source error, opreturn should not");
+            error!("[parse_opreturn] Unexpect opreturn source error");
             None
         }
     } else {
@@ -134,7 +145,7 @@ pub fn ensure_identical<T: Trait>(tx1: &Transaction, tx2: &Transaction) -> Dispa
             {
                 native!(
                     error,
-                    "[ensure_identical]|tx1 is different to tx2|tx1:{:?}|tx2:{:?}",
+                    "[ensure_identical] Tx1 is different to Tx2, tx1:{:?}, tx2:{:?}",
                     tx1,
                     tx2
                 );
diff --git a/xpallets/gateway/bitcoin/src/tx/validator.rs b/xpallets/gateway/bitcoin/src/tx/validator.rs
index 9a7da71a8..385e8d0d4 100644
--- a/xpallets/gateway/bitcoin/src/tx/validator.rs
+++ b/xpallets/gateway/bitcoin/src/tx/validator.rs
@@ -11,7 +11,8 @@ use sp_std::{prelude::Vec, result};
 use light_bitcoin::{chain::Transaction, primitives::H256, script::Script};
 
 // ChainX
-use xpallet_support::{debug, error, try_hex};
+use xp_logging::{debug, error};
+use xpallet_support::try_hex;
 
 // use crate::tx::utils::get_hot_trustee_redeem_script;
 use crate::trustee::get_hot_trustee_redeem_script;
@@ -25,7 +26,7 @@ pub fn validate_transaction<T: Trait>(
 ) -> DispatchResult {
     let tx_hash = tx.raw.hash();
     debug!(
-        "[validate_transaction]|txhash:{:}|relay tx:{:?}",
+        "[validate_transaction] tx_hash:{:?}, relay tx:{:?}",
         tx_hash, tx
     );
 
@@ -38,13 +39,13 @@ pub fn validate_transaction<T: Trait>(
         .map_err(|_| Error::<T>::BadMerkleProof)?;
     if merkle_root != hash {
         error!(
-            "[validate_transaction]|Check failed for merkle tree proof|merkle_root:{:?}|hash:{:?}",
+            "[validate_transaction] Check merkle tree proof error, merkle_root:{:?}, hash:{:?}",
             merkle_root, hash
         );
         return Err(Error::<T>::BadMerkleProof.into());
     }
     if !matches.iter().any(|h| *h == tx_hash) {
-        error!("[validate_transaction]|Tx hash should in matches of partial merkle tree");
+        error!("[validate_transaction] Tx hash should in matches of partial merkle tree");
         return Err(Error::<T>::BadMerkleProof.into());
     }
 
@@ -54,7 +55,10 @@ pub fn validate_transaction<T: Trait>(
         let previous_txid = prev.hash();
         let expected_id = tx.raw.inputs[0].previous_output.txid;
         if previous_txid != expected_id {
-            error!("[validate_transaction]|relay previou tx's hash not equail to relay tx first input|expected_id:{:?}|prev:{:?}", expected_id, previous_txid);
+            error!(
+                "[validate_transaction] Relay previous tx's hash not equal to relay tx first input, expected_id:{:?}, prev:{:?}",
+                expected_id, previous_txid
+            );
             return Err(Error::<T>::InvalidPrevTx.into());
         }
     }
@@ -97,7 +101,10 @@ pub fn parse_and_check_signed_tx_impl<T: Trait>(
                     .is_ok()
             });
             if !verify {
-                error!("[parse_and_check_signed_tx]|Verify sign failed|tx:{:?}|input:{:?}|bytes_sedeem_script:{:?}", tx, i, try_hex!(&bytes_redeem_script));
+                error!(
+                    "[parse_and_check_signed_tx] Verify sig failed, tx:{:?}, input:{:?}, bytes_redeem_script:{:?}",
+                    tx, i, try_hex!(&bytes_redeem_script)
+                );
                 return Err(Error::<T>::VerifySignFailed.into());
             }
         }
diff --git a/xpallets/gateway/common/Cargo.toml b/xpallets/gateway/common/Cargo.toml
index 41b702565..cf76469a2 100644
--- a/xpallets/gateway/common/Cargo.toml
+++ b/xpallets/gateway/common/Cargo.toml
@@ -22,6 +22,7 @@ frame-system = { version = "2.0.0", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
+xp-logging =  { path = "../../../primitives/logging", default-features = false }
 xp-io = { path = "../../../primitives/io", default-features = false, optional = true }
 xp-protocol = { path = "../../../primitives/protocol", default-features = false }
 xp-runtime = { path = "../../../primitives/runtime", default-features = false }
@@ -58,6 +59,7 @@ std = [
     "frame-system/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     "xp-io/std",
     "xp-protocol/std",
     "xp-runtime/std",
diff --git a/xpallets/gateway/common/src/binding.rs b/xpallets/gateway/common/src/binding.rs
index ea4d4038e..4511e32df 100644
--- a/xpallets/gateway/common/src/binding.rs
+++ b/xpallets/gateway/common/src/binding.rs
@@ -4,8 +4,9 @@ use frame_support::{IterableStorageDoubleMap, StorageDoubleMap};
 use sp_std::{collections::btree_map::BTreeMap, prelude::*};
 
 use chainx_primitives::{AssetId, ChainAddress, ReferralId};
+use xp_logging::{debug, error, info, warn};
 use xpallet_assets::Chain;
-use xpallet_support::{debug, error, info, str, traits::Validator, try_addr, warn};
+use xpallet_support::{str, traits::Validator, try_addr};
 
 use crate::traits::{AddrBinding, ChannelBinding};
 use crate::{AddressBinding, BoundAddressOf, Module, Trait};
@@ -13,11 +14,11 @@ use crate::{AddressBinding, BoundAddressOf, Module, Trait};
 impl<T: Trait> ChannelBinding<T::AccountId> for Module<T> {
     fn update_binding(assert_id: &AssetId, who: &T::AccountId, channel_name: Option<ReferralId>) {
         let chain = match xpallet_assets_registrar::Module::<T>::chain_of(assert_id) {
-            Ok(c) => c,
-            Err(e) => {
+            Ok(chain) => chain,
+            Err(err) => {
                 error!(
-                    "[update_binding]|meed an unexpected asset_id:{:?}, error:{:?}",
-                    assert_id, e
+                    "[update_channel_binding] Unexpected asset_id:{:?}, error:{:?}",
+                    assert_id, err
                 );
                 return;
             }
@@ -30,13 +31,16 @@ impl<T: Trait> ChannelBinding<T::AccountId> for Module<T> {
                         // set to storage
                         Self::set_referral_binding(chain, who.clone(), channel);
                     }
-                    Some(_channel) => {
-                        debug!("[update_binding]|already has binding, do nothing|assert_id:{:}|chain:{:?}|who:{:?}|channel:{:?}", assert_id, chain, who, _channel);
+                    Some(channel) => {
+                        debug!(
+                            "[update_channel_binding] Already has channel binding:[assert id:{}, chain:{:?}, who:{:?}, channel:{:?}]",
+                            assert_id, chain, who, channel
+                        );
                     }
                 }
             } else {
                 warn!(
-                    "[update_binding]|channel not exist, do not set binding|name:{:?}",
+                    "[update_channel_binding] {:?} has no channel, cannot update binding",
                     str!(&name)
                 );
             };
@@ -55,7 +59,7 @@ impl<T: Trait, Addr: Into<Vec<u8>>> AddrBinding<T::AccountId, Addr> for Module<T
         if let Some(accountid) = AddressBinding::<T>::get(chain, &address) {
             if accountid != who {
                 debug!(
-                    "[apply_update_binding]|current binding need change|old:{:?}|new:{:?}",
+                    "[update_addr_binding] Current address binding need to changed (old:{:?} => new:{:?})",
                     accountid, who
                 );
                 // old accountid is not equal to new accountid, means should change this addr bind to new account
@@ -73,7 +77,7 @@ impl<T: Trait, Addr: Into<Vec<u8>>> AddrBinding<T::AccountId, Addr> for Module<T
         });
 
         info!(
-            "[apply_update_binding]|update binding|chain:{:?}|addr:{:?}|who:{:?}",
+            "[update_addr_binding] Update address binding:[chain:{:?}, addr:{:?}, who:{:?}]",
             chain,
             try_addr!(address),
             who,
diff --git a/xpallets/gateway/common/src/extractor.rs b/xpallets/gateway/common/src/extractor.rs
index d4efd5767..c14241035 100644
--- a/xpallets/gateway/common/src/extractor.rs
+++ b/xpallets/gateway/common/src/extractor.rs
@@ -4,7 +4,8 @@ use sp_runtime::AccountId32;
 use sp_std::prelude::Vec;
 
 use chainx_primitives::ReferralId;
-use xpallet_support::{debug, error, str};
+use xp_logging::{debug, error};
+use xpallet_support::str;
 
 use crate::traits::Extractable;
 
@@ -14,13 +15,13 @@ use crate::traits::Extractable;
 pub fn parse_address(data: &[u8]) -> Option<AccountId32> {
     use xp_io::ss_58_codec::from_ss58check;
     from_ss58check(data)
-        .map_err(|e| {
+        .map_err(|err| {
             error!(
-                "[parse_address]|parse account error|src:{:?}|reason:{:?}",
+                "[parse_address] Parse account `{:?}` error:{:?}",
                 str!(data),
-                e
+                err
             );
-            e
+            err
         })
         .ok()
 }
@@ -35,19 +36,19 @@ pub fn parse_address(data: &[u8]) -> Option<AccountId32> {
     // parse data from base58 to raw
     let d = bs58::decode(data)
         .into_vec()
-        .map_err(|e| {
+        .map_err(|err| {
             error!(
-                "[parse_address]|parse base58 err|e:{:?}|data:{:?}",
-                e,
-                str!(data)
+                "[parse_address] Base58 decode `{:?}` err:{:?}",
+                str!(data),
+                err,
             );
-            e
+            err
         })
         .ok()?;
     if d.len() != len + 3 {
         // Invalid length.
         error!(
-            "[parse_address]|bad length|data len:{:}|len:{:}",
+            "[parse_address] Bad length, data len:{}, len:{}",
             d.len(),
             len
         );
@@ -77,7 +78,7 @@ impl Extractable<AccountId32> for Extractor {
     fn account_info(data: &[u8]) -> Option<(AccountId32, Option<ReferralId>)> {
         let v = split(data);
         if v.is_empty() {
-            error!("[account_info]|can't parse data|data:{:?}", str!(data));
+            error!("[account_info] Can't parse data:{:?}", str!(data));
             return None;
         }
 
@@ -90,7 +91,7 @@ impl Extractable<AccountId32> for Extractor {
         };
 
         debug!(
-            "[extract_account_info]||target_account:{:?}|referral_id:{:?}",
+            "[extract_account_info] target_account:{:?}, referral_id:{:?}",
             target_account, referral_id
         );
         Some((target_account, referral_id))
diff --git a/xpallets/gateway/common/src/lib.rs b/xpallets/gateway/common/src/lib.rs
index bd33af6b0..544a89011 100644
--- a/xpallets/gateway/common/src/lib.rs
+++ b/xpallets/gateway/common/src/lib.rs
@@ -23,20 +23,16 @@ use sp_std::{collections::btree_map::BTreeMap, convert::TryFrom, prelude::*, res
 use frame_support::{
     decl_error, decl_event, decl_module, decl_storage,
     dispatch::{DispatchError, DispatchResult},
-    ensure,
-    traits::Currency,
-    IterableStorageMap,
+    ensure, IterableStorageMap,
 };
 use frame_system::{ensure_root, ensure_signed};
 
 use chainx_primitives::{AddrStr, AssetId, ChainAddress, Text};
+use xp_logging::{error, info};
 use xp_runtime::Memo;
-use xpallet_assets::{AssetRestrictions, Chain, ChainT, WithdrawalLimit};
+use xpallet_assets::{AssetRestrictions, BalanceOf, Chain, ChainT, WithdrawalLimit};
 use xpallet_gateway_records::WithdrawalState;
-use xpallet_support::{
-    error, info,
-    traits::{MultisigAddressFor, Validator},
-};
+use xpallet_support::traits::{MultisigAddressFor, Validator};
 
 use crate::traits::TrusteeForChain;
 use crate::types::{
@@ -45,10 +41,6 @@ use crate::types::{
 };
 use crate::weight_info::WeightInfo;
 
-pub type BalanceOf<T> = <<T as xpallet_assets::Trait>::Currency as Currency<
-    <T as frame_system::Trait>::AccountId,
->>::Balance;
-
 pub trait Trait: xpallet_gateway_records::Trait {
     type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
 
@@ -172,7 +164,7 @@ decl_module! {
             };
 
             info!(
-                "[transition_trustee_session_by_root]|try to transition trustee|chain:{:?}|new_trustees:{:?}",
+                "[transition_trustee_session_by_root] Try to transition trustees, chain:{:?}, new_trustees:{:?}",
                 chain,
                 new_trustees
             );
@@ -362,7 +354,7 @@ impl<T: Trait> Module<T> {
             (1..new_trustees.len()).any(|i| new_trustees[i..].contains(&new_trustees[i - 1]));
         if has_duplicate {
             error!(
-                "[try_generate_session_info]|existing duplicate account|candidates:{:?}",
+                "[try_generate_session_info] Duplicate account, candidates:{:?}",
                 new_trustees
             );
             return Err(Error::<T>::DuplicatedAccountId.into());
@@ -370,7 +362,10 @@ impl<T: Trait> Module<T> {
         let mut props = Vec::with_capacity(new_trustees.len());
         for accountid in new_trustees.into_iter() {
             let p = Self::trustee_intention_props_of(&accountid, chain).ok_or_else(|| {
-                error!("[transition_trustee_session]|some candidate has not registered as a trustee|who:{:?}",  accountid);
+                error!(
+                    "[transition_trustee_session] Candidate {:?} has not registered as a trustee",
+                    accountid
+                );
                 Error::<T>::NotRegistered
             })?;
             props.push((accountid, p));
diff --git a/xpallets/gateway/common/src/trustees/mod.rs b/xpallets/gateway/common/src/trustees/mod.rs
index b6c377f8a..82f857129 100644
--- a/xpallets/gateway/common/src/trustees/mod.rs
+++ b/xpallets/gateway/common/src/trustees/mod.rs
@@ -10,8 +10,9 @@ use serde::{Deserialize, Serialize};
 
 use frame_support::{dispatch::DispatchError, traits::Contains};
 
+use xp_logging::{error, warn};
 use xpallet_assets::Chain;
-use xpallet_support::{error, traits::MultiSig, warn};
+use xpallet_support::traits::MultiSig;
 
 use crate::traits::{BytesLike, ChainProvider, TrusteeSession};
 use crate::types::{TrusteeIntentionProps, TrusteeSessionInfo};
@@ -32,7 +33,7 @@ impl<T: Trait, TrusteeAddress: BytesLike + ChainProvider>
         let generic_info =
             Module::<T>::trustee_session_info_of(chain, number).ok_or_else(|| {
                 error!(
-                    "[trustee_session]|not found info for this session|chain:{:?}|number:{:}",
+                    "[trustee_session] Can not find session info, chain:{:?}, number:{}",
                     chain, number
                 );
                 Error::<T>::InvalidTrusteeSession
@@ -59,12 +60,12 @@ impl<T: Trait, TrusteeAddress: BytesLike + ChainProvider>
             Some(r) => r,
             None => u32::max_value(),
         };
-        Self::trustee_session(number).map_err(|e| {
+        Self::trustee_session(number).map_err(|err| {
             warn!(
-                "[last_trustee_session]|last trustee session not exist yet for this chain|Chain:{:?}",
+                "[last_trustee_session] Last trustee session not exist yet for chain:{:?}",
                 chain
             );
-            e
+            err
         })
     }
 
diff --git a/xpallets/gateway/records/Cargo.toml b/xpallets/gateway/records/Cargo.toml
index 5d7743ad5..ed9164c56 100644
--- a/xpallets/gateway/records/Cargo.toml
+++ b/xpallets/gateway/records/Cargo.toml
@@ -22,6 +22,7 @@ orml-utilities = { version = "0.3", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
+xp-logging = { path = "../../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../../primitives/protocol", default-features = false }
 xp-runtime = { path = "../../../primitives/runtime", default-features = false }
 
@@ -50,6 +51,7 @@ std = [
     "orml-utilities/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     "xp-protocol/std",
     "xp-runtime/std",
     # ChainX pallets
diff --git a/xpallets/gateway/records/src/lib.rs b/xpallets/gateway/records/src/lib.rs
index 1ea38fa40..c4f2840fb 100644
--- a/xpallets/gateway/records/src/lib.rs
+++ b/xpallets/gateway/records/src/lib.rs
@@ -25,9 +25,10 @@ use sp_runtime::traits::StaticLookup;
 use orml_utilities::with_transaction_result;
 
 use chainx_primitives::{AddrStr, AssetId};
+use xp_logging::{error, info};
 use xp_runtime::Memo;
 use xpallet_assets::{AssetType, BalanceOf, Chain};
-use xpallet_support::{error, info, try_addr};
+use xpallet_support::try_addr;
 
 pub use self::types::{Withdrawal, WithdrawalRecord, WithdrawalRecordId, WithdrawalState};
 use crate::weight_info::WeightInfo;
@@ -210,7 +211,7 @@ impl<T: Trait> Module<T> {
         xpallet_assets::Module::<T>::ensure_not_native_asset(&asset_id)?;
 
         info!(
-            "[deposit]|who:{:?}|asset_id:{:}|balance:{:?}",
+            "[deposit] who:{:?}, id:{}, balance:{:?}",
             who, asset_id, balance
         );
 
@@ -236,7 +237,7 @@ impl<T: Trait> Module<T> {
 
         let id = Self::id();
         info!(
-            "[apply_withdrawal]|id:{:}|who:{:?}|asset_id:{:}|balance:{:?}|addr:{:?}|memo:{:}",
+            "[apply_withdrawal] id:{}, who:{:?}, asset id:{}, balance:{:?}, addr:{:?}, memo:{}",
             id,
             who,
             asset_id,
@@ -276,7 +277,7 @@ impl<T: Trait> Module<T> {
     ) -> DispatchResult {
         if curr_state != WithdrawalState::Applying {
             error!(
-                "[process_withdrawal]|Current withdrawal state must be `Applying`|id:{:}|state:{:?}",
+                "[process_withdrawal] id:{}, current withdrawal state ({:?}) must be `Applying`",
                 id, curr_state
             );
             return Err(Error::<T>::NotApplyingState.into());
@@ -311,7 +312,7 @@ impl<T: Trait> Module<T> {
     ) -> DispatchResult {
         if curr_state != WithdrawalState::Processing {
             error!(
-                "[recover_withdrawal]|Current withdrawal state must be `Processing`|id:{:}|state:{:?}",
+                "[recover_withdrawal] id:{}, current withdrawal state ({:?}) must be `Processing`",
                 id, curr_state
             );
             return Err(Error::<T>::NotProcessingState.into());
@@ -328,9 +329,10 @@ impl<T: Trait> Module<T> {
         let (record, curr_state) = Self::ensure_withdrawal_records_exists(id)?;
         if record.applicant() != who {
             error!(
-                "[cancel_withdrawal]|The applicant is not this account|applicant:{:?}|who:{:?}",
-                record.applicant(),
-                who
+                "[cancel_withdrawal] id:{}, account {:?} is not the applicant {:?}",
+                id,
+                who,
+                record.applicant()
             );
             return Err(Error::<T>::InvalidAccount.into());
         }
@@ -346,7 +348,7 @@ impl<T: Trait> Module<T> {
     ) -> DispatchResult {
         if curr_state != WithdrawalState::Applying {
             error!(
-                "[cancel_withdrawal]|Current withdrawal state must be `Applying`|id:{:}|state:{:?}",
+                "[cancel_withdrawal] id:{}, current withdrawal state ({:?}) must be `Applying`",
                 id, curr_state
             );
             return Err(Error::<T>::NotApplyingState.into());
@@ -395,7 +397,7 @@ impl<T: Trait> Module<T> {
     ) -> DispatchResult {
         if curr_state != WithdrawalState::Processing {
             error!(
-                "[finish_withdrawal]|Current withdrawal state must be `Processing`|id:{:}|state:{:?}",
+                "[finish_withdrawal] id:{}, current withdrawal state ({:?}) must be `Processing`",
                 id, curr_state
             );
             return Err(Error::<T>::NotProcessingState.into());
@@ -458,7 +460,11 @@ impl<T: Trait> Module<T> {
                 Self::finish_withdrawal_impl(id, record, curr_state, new_state)
             }
             _ => {
-                error!("[set_withdrawal_state_by_root]|Should not meet this branch in normally, except in root|current state:{:?}|new state:{:?}", curr_state, new_state);
+                error!(
+                    "[set_withdrawal_state_by_root] Shouldn't happen normally, unless called by root, \
+                    current state:{:?}, new state:{:?}",
+                    curr_state, new_state
+                );
                 Err("Do not expect this state in set_withdrawal_state_by_root".into())
             }
         }
@@ -472,14 +478,20 @@ impl<T: Trait> Module<T> {
         let (record, state) = Self::ensure_withdrawal_records_exists(id)?;
         Self::ensure_asset_belongs_to_chain(record.asset_id(), chain)?;
         if state != WithdrawalState::Processing {
-            error!("[set_withdrawal_state_by_trustees]|Current withdrawal state must be `Processing` for this WithdrawalRecord|id:{:}|state:{:?}", id, state);
+            error!(
+                "[set_withdrawal_state_by_trustees] id:{}, current withdrawal state ({:?}) must be `Processing`",
+                id, state
+            );
             return Err(Error::<T>::NotProcessingState.into());
         }
 
         match new_state {
             WithdrawalState::RootFinish | WithdrawalState::RootCancel => { /*do nothing*/ }
             _ => {
-                error!("[set_withdrawal_state_by_trustees]|New withdrawal state must be `RootFinish` or `RootCancel`|state:{:?}", new_state);
+                error!(
+                    "[set_withdrawal_state_by_trustees] id:{}, new withdrawal state ({:?}) must be `RootFinish` or `RootCancel`",
+                    id, new_state
+                );
                 return Err(Error::<T>::InvalidState.into());
             }
         }
diff --git a/xpallets/genesis-builder/Cargo.toml b/xpallets/genesis-builder/Cargo.toml
index 030ec546a..94bf5f3ba 100644
--- a/xpallets/genesis-builder/Cargo.toml
+++ b/xpallets/genesis-builder/Cargo.toml
@@ -20,6 +20,7 @@ pallet-balances = { version = "2.0.0", default-features = false }
 # ChainX primitives
 chainx-primitives = { path = "../../primitives", default-features = false }
 xp-genesis-builder = { path = "../../primitives/genesis-builder", default-features = false }
+xp-logging = { path = "../../primitives/logging", default-features = false }
 xp-protocol = { path = "../../primitives/protocol", default-features = false }
 
 # ChainX pallets
@@ -43,6 +44,7 @@ std = [
     # ChainX primitives
     "chainx-primitives/std",
     "xp-genesis-builder/std",
+    "xp-logging/std",
     "xp-protocol/std",
     # ChainX pallets
     "xpallet-assets/std",
diff --git a/xpallets/genesis-builder/src/lib.rs b/xpallets/genesis-builder/src/lib.rs
index 394106266..5ec2f5c53 100644
--- a/xpallets/genesis-builder/src/lib.rs
+++ b/xpallets/genesis-builder/src/lib.rs
@@ -11,9 +11,9 @@ use frame_support::{decl_module, decl_storage};
 
 #[cfg(feature = "std")]
 use xp_genesis_builder::AllParams;
+use xp_logging::info;
 use xpallet_assets::BalanceOf as AssetBalanceOf;
 use xpallet_mining_staking::BalanceOf as StakingBalanceOf;
-use xpallet_support::info;
 
 pub trait Trait:
     pallet_balances::Trait + xpallet_mining_asset::Trait + xpallet_mining_staking::Trait
diff --git a/xpallets/mining/asset/Cargo.toml b/xpallets/mining/asset/Cargo.toml
index a973040c1..7c5053d5e 100644
--- a/xpallets/mining/asset/Cargo.toml
+++ b/xpallets/mining/asset/Cargo.toml
@@ -21,6 +21,7 @@ frame-system = { version = "2.0.0", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
+xp-logging = { path = "../../../primitives/logging", default-features = false }
 xp-mining-common = { path  = "../../../primitives/mining/common", default-features = false }
 xp-mining-staking = { path  = "../../../primitives/mining/staking", default-features = false }
 xp-protocol = { path = "../../../primitives/protocol", default-features = false }
@@ -55,6 +56,7 @@ std = [
     "frame-system/std",
     # ChainX primitives
     "chainx-primitives/std",
+    "xp-logging/std",
     "xp-mining-common/std",
     "xp-mining-staking/std",
     "xp-protocol/std",
diff --git a/xpallets/mining/asset/src/lib.rs b/xpallets/mining/asset/src/lib.rs
index 08676ac2e..2811f15e4 100644
--- a/xpallets/mining/asset/src/lib.rs
+++ b/xpallets/mining/asset/src/lib.rs
@@ -30,12 +30,13 @@ use frame_system::{ensure_root, ensure_signed};
 use sp_runtime::traits::{SaturatedConversion, Zero};
 
 use chainx_primitives::AssetId;
+use xp_logging::warn;
 use xp_mining_common::{
     Claim, ComputeMiningWeight, MiningWeight as _, RewardPotAccountFor, WeightType,
     ZeroMiningWeightError,
 };
 use xpallet_assets::{AssetType, BalanceOf};
-use xpallet_support::{traits::TreasuryAccount, warn};
+use xpallet_support::traits::TreasuryAccount;
 
 pub use self::impls::SimpleAssetRewardPotAccountDeterminer;
 pub use self::rpc::*;
diff --git a/xpallets/mining/staking/Cargo.toml b/xpallets/mining/staking/Cargo.toml
index 981fdccec..2a654f4d8 100644
--- a/xpallets/mining/staking/Cargo.toml
+++ b/xpallets/mining/staking/Cargo.toml
@@ -24,10 +24,11 @@ pallet-session = { version = "2.0.0", default-features = false }
 
 # ChainX primitives
 chainx-primitives = { path = "../../../primitives", default-features = false }
-xp-runtime = { path = "../../../primitives/runtime", default-features = false }
+xp-genesis-builder = { path = "../../../primitives/genesis-builder", optional = true }
+xp-logging = { path  = "../../../primitives/logging", default-features = false }
 xp-mining-common = { path  = "../../../primitives/mining/common", default-features = false }
 xp-mining-staking = { path  = "../../../primitives/mining/staking", default-features = false }
-xp-genesis-builder = { path = "../../../primitives/genesis-builder", optional = true }
+xp-runtime = { path = "../../../primitives/runtime", default-features = false }
 
 # ChainX pallets
 xpallet-support = { path = "../../support", default-features = false }
@@ -59,6 +60,7 @@ std = [
     # ChainX primitives
     "chainx-primitives/std",
     "xp-genesis-builder/std",
+    "xp-logging/std",
     "xp-mining-common/std",
     "xp-mining-staking/std",
     "xp-runtime/std",
diff --git a/xpallets/mining/staking/src/election.rs b/xpallets/mining/staking/src/election.rs
index 94a57fa56..157c07572 100644
--- a/xpallets/mining/staking/src/election.rs
+++ b/xpallets/mining/staking/src/election.rs
@@ -15,7 +15,7 @@ impl<T: Trait> Module<T> {
         // Set staking information for new era.
         let maybe_new_validators = Self::select_and_update_validators(current_era);
         debug!(
-            "[new_era]era_index:{}, start_session_index:{}, maybe_new_validators:{:?}",
+            "[new_era] era_index:{}, start_session_index:{}, maybe_new_validators:{:?}",
             current_era, start_session_index, maybe_new_validators
         );
 
@@ -40,7 +40,7 @@ impl<T: Trait> Module<T> {
             Self::validator_self_bonded(who) >= self_bonded && Self::total_votes_of(who) >= total;
 
         if !threshold_satisfied && Self::try_force_chilled(who).is_ok() {
-            xpallet_support::info!("[meet_candidate_threshold] force {:?} to be inactive since it doesn't meet the minimum bond requirement", who);
+            xp_logging::info!("[meet_candidate_threshold] Force {:?} to be inactive since it doesn't meet the minimum bond requirement", who);
         }
 
         threshold_satisfied
@@ -66,7 +66,7 @@ impl<T: Trait> Module<T> {
         // TODO: might move to offchain worker solution in the future.
         // Currently there is no performance issue practically.
         let candidates = Self::filter_out_candidates();
-        debug!("[select_and_update_validators]candidates:{:?}", candidates);
+        debug!("[select_and_update_validators] candidates:{:?}", candidates);
 
         // Avoid reevaluate validator set if it would leave us with fewer than the minimum
         // needed validators.
diff --git a/xpallets/mining/staking/src/impls.rs b/xpallets/mining/staking/src/impls.rs
index f8469156c..da2f2ee88 100644
--- a/xpallets/mining/staking/src/impls.rs
+++ b/xpallets/mining/staking/src/impls.rs
@@ -230,7 +230,7 @@ impl<T: Trait> Module<T> {
         if let Some(offenders) = SessionOffenders::<T>::take() {
             let force_chilled = Self::slash_offenders_in_session(offenders, validator_rewards);
             if !force_chilled.is_empty() {
-                debug!("Force chilled: {:?}", force_chilled);
+                debug!("Force chilled:{:?}", force_chilled);
                 Self::deposit_event(Event::<T>::ForceChilled(session_index, force_chilled));
                 // Force a new era if some offender's reward pot has been wholly slashed.
                 Self::ensure_new_era();
@@ -242,7 +242,7 @@ impl<T: Trait> Module<T> {
 impl<T: Trait> Module<T> {
     fn new_session(session_index: SessionIndex) -> Option<Vec<T::AccountId>> {
         debug!(
-            "[new_session]session_index:{:?}, current_era:{:?}",
+            "[new_session] session_index:{:?}, current_era:{:?}",
             session_index,
             Self::current_era(),
         );
@@ -296,7 +296,7 @@ impl<T: Trait> Module<T> {
 
         let next_active_era = Self::active_era().map(|e| e.index + 1).unwrap_or(0);
         debug!(
-            "[start_session]start_session:{}, next_active_era:{:?}",
+            "[start_session] start_session:{}, next_active_era:{:?}",
             start_session, next_active_era
         );
         if let Some(next_active_era_start_session_index) =
@@ -410,7 +410,7 @@ where
             .collect::<BTreeMap<_, _>>();
 
         debug!(
-            "Reported the offenders:{:?} happend in session {:?}",
+            "Reported the offenders:{:?} happened in session {:?}",
             offenders_tuple, slash_session
         );
 
diff --git a/xpallets/mining/staking/src/lib.rs b/xpallets/mining/staking/src/lib.rs
index 196d5b7d3..7fe5bad6d 100644
--- a/xpallets/mining/staking/src/lib.rs
+++ b/xpallets/mining/staking/src/lib.rs
@@ -43,10 +43,11 @@ use sp_runtime::{
 use sp_std::collections::btree_map::BTreeMap;
 
 use chainx_primitives::ReferralId;
+use xp_logging::debug;
 pub use xp_mining_common::RewardPotAccountFor;
 use xp_mining_common::{Claim, ComputeMiningWeight, Delta, ZeroMiningWeightError};
 use xp_mining_staking::{AssetMining, SessionIndex, UnbondedIndex};
-use xpallet_support::{debug, traits::TreasuryAccount};
+use xpallet_support::traits::TreasuryAccount;
 
 use self::constants::*;
 pub use self::impls::{IdentificationTuple, SimpleValidatorRewardPotAccountDeterminer};
@@ -998,7 +999,7 @@ impl<T: Trait> Module<T> {
         value: BalanceOf<T>,
     ) -> Result<(), Error<T>> {
         debug!(
-            "[apply_unbond] who:{:?}, target: {:?}, value: {:?}",
+            "[apply_unbond] who:{:?}, target:{:?}, value:{:?}",
             who, target, value
         );
         Self::unbond_reserve(who, value)?;
diff --git a/xpallets/mining/staking/src/reward/mod.rs b/xpallets/mining/staking/src/reward/mod.rs
index ee007f324..252ee48d3 100644
--- a/xpallets/mining/staking/src/reward/mod.rs
+++ b/xpallets/mining/staking/src/reward/mod.rs
@@ -1,8 +1,8 @@
 // Copyright 2019-2020 ChainX Project Authors. Licensed under GPL-3.0.
 
 use super::*;
+use xp_logging::debug;
 use xp_mining_staking::SessionIndex;
-use xpallet_support::debug;
 
 mod proposal09;
 
diff --git a/xpallets/mining/staking/src/reward/proposal09.rs b/xpallets/mining/staking/src/reward/proposal09.rs
index df0533998..49bef2c6e 100644
--- a/xpallets/mining/staking/src/reward/proposal09.rs
+++ b/xpallets/mining/staking/src/reward/proposal09.rs
@@ -3,7 +3,7 @@
 //! New minted PCX distribution logic for ChainX Proposal 09.
 
 use super::*;
-use xpallet_support::debug;
+use xp_logging::debug;
 
 impl<T: Trait> Module<T> {
     fn generic_calculate_by_proportion<S: Into<u128>>(
@@ -124,7 +124,7 @@ impl<T: Trait> Module<T> {
             Self::distribute_to_mining_assets(real_asset_mining_reward);
         if !unpaid_asset_mining_reward.is_zero() {
             debug!(
-                "[distribute_mining_rewards]unpaid_asset_mining_reward:{:?}",
+                "[distribute_mining_rewards] unpaid_asset_mining_reward:{:?}",
                 unpaid_asset_mining_reward
             );
             Self::mint(treasury_account, unpaid_asset_mining_reward);
diff --git a/xpallets/mining/staking/src/types.rs b/xpallets/mining/staking/src/types.rs
index d35dd248e..5377d9045 100644
--- a/xpallets/mining/staking/src/types.rs
+++ b/xpallets/mining/staking/src/types.rs
@@ -12,9 +12,9 @@ use sp_runtime::{
 };
 
 use chainx_primitives::{AssetId, ReferralId};
+use xp_logging::debug;
 use xp_mining_common::{RewardPotAccountFor, WeightType};
 use xp_mining_staking::MiningPower;
-use xpallet_support::debug;
 
 use crate::{AssetMining, BalanceOf, EraIndex, Event, Module, Trait};
 
diff --git a/xpallets/support/Cargo.toml b/xpallets/support/Cargo.toml
index bdd6e774e..0e469a61b 100644
--- a/xpallets/support/Cargo.toml
+++ b/xpallets/support/Cargo.toml
@@ -7,14 +7,11 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.4", features = ["derive"], default-features = false }
 hex = { version = "0.4", default-features = false }
-serde = { version = "1.0", optional = true }
+serde = { version = "1.0", features = ["derive"], optional = true }
 
 # Substrate primitives
 sp-std = { version = "2.0.0", default-features = false }
 
-# Substrate pallets
-frame-support = { version = "2.0.0", default-features = false }
-
 [dev-dependencies]
 serde_json = "1.0"
 
@@ -26,6 +23,4 @@ std = [
     "serde",
     # Substrate primitives
     "sp-std/std",
-    # Substrate pallets
-    "frame-support/std",
 ]
diff --git a/xpallets/support/src/lib.rs b/xpallets/support/src/lib.rs
index bea879dc7..97e27d8bb 100644
--- a/xpallets/support/src/lib.rs
+++ b/xpallets/support/src/lib.rs
@@ -10,8 +10,6 @@ pub mod traits;
 #[cfg(feature = "std")]
 pub mod x_std;
 
-pub use frame_support::fail;
-
 pub use self::macros::*;
 #[cfg(feature = "std")]
 pub use self::serde::{
diff --git a/xpallets/support/src/macros.rs b/xpallets/support/src/macros.rs
index 7ddfe0ab3..791bb6174 100644
--- a/xpallets/support/src/macros.rs
+++ b/xpallets/support/src/macros.rs
@@ -1,7 +1,5 @@
 // Copyright 2019-2020 ChainX Project Authors. Licensed under GPL-3.0.
 
-pub use self::log::*;
-
 #[cfg(feature = "std")]
 #[macro_export]
 macro_rules! str {
@@ -56,93 +54,3 @@ macro_rules! try_hex {
         &$x
     }};
 }
-
-#[cfg(feature = "std")]
-#[macro_export]
-macro_rules! ensure_with_errorlog {
-    ( $x:expr, $y:expr, $($arg:tt)*) => {{
-        if !$x {
-            $crate::error!("{:?}|{}", $y, format!($($arg)*));
-            $crate::fail!($y);
-        }
-    }}
-    }
-
-#[cfg(not(feature = "std"))]
-#[macro_export]
-macro_rules! ensure_with_errorlog {
-    ( $x:expr, $y:expr, $($arg:tt)*) => {{
-        if !$x {
-            $crate::fail!($y);
-        }
-    }};
-}
-
-pub mod log {
-    pub const RUNTIME_TARGET: &str = "runtime";
-
-    #[macro_export]
-    macro_rules! error {
-        (target: $target:expr, $($arg:tt)+) => (
-            frame_support::debug::error!(target: $target, $($arg)+);
-        );
-        ($($arg:tt)+) => (
-            #[cfg(feature = "std")]
-            $crate::error!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
-            #[cfg(not(feature = "std"))]
-            $crate::error!(target: "runtime", $($arg)+);
-        )
-    }
-
-    #[macro_export]
-    macro_rules! warn {
-        (target: $target:expr, $($arg:tt)+) => (
-            frame_support::debug::warn!(target: $target, $($arg)+);
-        );
-        ($($arg:tt)+) => (
-            #[cfg(feature = "std")]
-            $crate::warn!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
-            #[cfg(not(feature = "std"))]
-            $crate::warn!(target: "runtime", $($arg)+);
-        )
-    }
-
-    #[macro_export]
-    macro_rules! info {
-        (target: $target:expr, $($arg:tt)+) => (
-            frame_support::debug::info!(target: $target, $($arg)+);
-        );
-        ($($arg:tt)+) => (
-            #[cfg(feature = "std")]
-            $crate::info!(target: &format!("runtime::{}", module_path!()), $($arg)+);
-            #[cfg(not(feature = "std"))]
-            $crate::info!(target: "runtime", $($arg)+);
-        )
-    }
-
-    #[macro_export]
-    macro_rules! debug {
-        (target: $target:expr, $($arg:tt)+) => (
-            frame_support::debug::debug!(target: $target, $($arg)+);
-        );
-        ($($arg:tt)+) => (
-            #[cfg(feature = "std")]
-            $crate::debug!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
-            #[cfg(not(feature = "std"))]
-            $crate::debug!(target: "runtime", $($arg)+);
-        )
-    }
-
-    #[macro_export]
-    macro_rules! trace {
-        (target: $target:expr, $($arg:tt)+) => (
-            frame_support::debug::trace!(target: $target, $($arg)+);
-        );
-        ($($arg:tt)+) => (
-            #[cfg(feature = "std")]
-            $crate::trace!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
-            #[cfg(not(feature = "std"))]
-            $crate::trace!(target: "runtime", $($arg)+);
-        )
-    }
-}
diff --git a/xpallets/transaction-fee/Cargo.toml b/xpallets/transaction-fee/Cargo.toml
index eea6e6e55..4d4002abb 100644
--- a/xpallets/transaction-fee/Cargo.toml
+++ b/xpallets/transaction-fee/Cargo.toml
@@ -10,35 +10,26 @@ targets = ["x86_64-unknown-linux-gnu"]
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
 serde = { version = "1.0.101", optional = true }
-smallvec = "1.4.1"
 
-sp-core = { version = "2.0.0", default-features = false }
-sp-io = { version = "2.0.0", default-features = false }
+# Substrate primitives
 sp-runtime = { version = "2.0.0", default-features = false }
 sp-std = { version = "2.0.0", default-features = false }
 
+# Substrate pallets
 frame-support = { version = "2.0.0", default-features = false }
 frame-system = { version = "2.0.0", default-features = false }
 pallet-transaction-payment = { version = "2.0.0", default-features = false }
-pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0", default-features = false }
-
-xpallet-support = { path = "../../xpallets/support", default-features = false }
 
 [features]
 default = ["std"]
 std = [
     "codec/std",
     "serde",
-
-    "sp-core/std",
-    "sp-io/std",
+    # Substrate primitives
     "sp-runtime/std",
     "sp-std/std",
-
+    # Substrate pallets
     "frame-support/std",
     "frame-system/std",
     "pallet-transaction-payment/std",
-    "pallet-transaction-payment-rpc-runtime-api/std",
-
-    "xpallet-support/std",
 ]
diff --git a/xpallets/transaction-fee/rpc/Cargo.toml b/xpallets/transaction-fee/rpc/Cargo.toml
index 79682e37d..fecca32d0 100644
--- a/xpallets/transaction-fee/rpc/Cargo.toml
+++ b/xpallets/transaction-fee/rpc/Cargo.toml
@@ -14,14 +14,17 @@ jsonrpc-core-client = "15.0.0"
 jsonrpc-derive = "15.0.0"
 serde = { version = "1.0.101", features = ["derive"] }
 
+# Substrate primitives
 sp-api = "2.0.0"
 sp-blockchain = "2.0.0"
 sp-core = "2.0.0"
-sp-rpc = "2.0.0"
 sp-runtime = "2.0.0"
 
+# Substrate pallets
 pallet-transaction-payment-rpc = "2.0.0"
 
+# ChainX pallets
 xpallet-support = { path = "../../support" }
 
+# ChainX pallets api
 xpallet-transaction-fee-rpc-runtime-api = { path = "./runtime-api" }
diff --git a/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml b/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml
index d8f77aa51..a0ce68554 100644
--- a/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml
+++ b/xpallets/transaction-fee/rpc/runtime-api/Cargo.toml
@@ -10,16 +10,20 @@ targets = ["x86_64-unknown-linux-gnu"]
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
 
+# Substrate primtives
 sp-api = { version = "2.0.0", default-features = false }
 sp-runtime = { version = "2.0.0", default-features = false }
 
+# ChainX pallets
 xpallet-transaction-fee = { path = "../..", default-features = false }
 
 [features]
 default = ["std"]
 std = [
     "codec/std",
+    # Substrate primtives
     "sp-api/std",
     "sp-runtime/std",
+    # ChainX pallets
     "xpallet-transaction-fee/std",
 ]


Test patch: