move module-specific logging to the modules that use it

This commit is contained in:
James Deikun 2018-05-31 17:05:00 -04:00
parent b2e6001007
commit afa335ff48
34 changed files with 176 additions and 56 deletions

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "node.main" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.Node.Main open Node_logging
let genesis : State.Chain.genesis = { let genesis : State.Chain.genesis = {
time = time =

View File

@ -8,7 +8,7 @@
(**************************************************************************) (**************************************************************************)
open Cmdliner open Cmdliner
open Logging.Node.Main open Node_logging
let (//) = Filename.concat let (//) = Filename.concat

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
let log = Logging.Client.Sign.lwt_log_notice let log = Signer_logging.lwt_log_notice
let sign (cctxt : #Client_context.wallet) pkh data = let sign (cctxt : #Client_context.wallet) pkh data =
log "Request for signing %d bytes of data for key %a, magic byte = %02X" log "Request for signing %d bytes of data for key %a, magic byte = %02X"

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
let log = Logging.Client.Sign.lwt_log_notice let log = Signer_logging.lwt_log_notice
let run (cctxt : #Client_context.wallet) ~host ~port ~cert ~key = let run (cctxt : #Client_context.wallet) ~host ~port ~cert ~key =
log "Accepting HTTPS requests on port %d" port >>= fun () -> log "Accepting HTTPS requests on port %d" port >>= fun () ->

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "client.signer" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -9,7 +9,7 @@
open Signer_messages open Signer_messages
let log = Logging.Client.Sign.lwt_log_notice let log = Signer_logging.lwt_log_notice
let run (cctxt : #Client_context.wallet) path = let run (cctxt : #Client_context.wallet) path =
Lwt_utils_unix.Socket.bind path >>=? fun fd -> Lwt_utils_unix.Socket.bind path >>=? fun fd ->

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "base" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -18,7 +18,7 @@ let () =
| Exit -> () | Exit -> ()
| exn -> | exn ->
let backtrace = Printexc.get_backtrace () in let backtrace = Printexc.get_backtrace () in
Logging.Node.Main.fatal_error "@[<v 2>%a%a@]" Base_logging.fatal_error "@[<v 2>%a%a@]"
(fun ppf exn -> (fun ppf exn ->
Format.fprintf ppf Format.fprintf ppf
"@[Uncaught (asynchronous) exception (%d):@ %a@]" "@[Uncaught (asynchronous) exception (%d):@ %a@]"

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.Updater open Updater_logging
let (//) = Filename.concat let (//) = Filename.concat

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "updater" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "rpc" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -12,4 +12,4 @@ type cors = Resto_cohttp.Cors.t = {
allowed_origins : string list ; allowed_origins : string list ;
} }
include Resto_cohttp.Server.Make(RPC_encoding)(Logging.RPC) include Resto_cohttp.Server.Make(RPC_encoding)(RPC_logging)

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.Node.State open State_logging
let mempool_encoding = Mempool.encoding let mempool_encoding = Mempool.encoding

View File

@ -8,7 +8,7 @@
(**************************************************************************) (**************************************************************************)
open Lwt.Infix open Lwt.Infix
open Logging.Node.Worker open Worker_logging
let inject_operation validator ?chain_id bytes = let inject_operation validator ?chain_id bytes =
let t = let t =

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.RPC open RPC_logging
let filter_bi operations (bi: Block_services.block_info) = let filter_bi operations (bi: Block_services.block_info) =
let bi = if operations then bi else { bi with operations = None } in let bi = if operations then bi else { bi with operations = None } in

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.Node.State open State_logging
open Validation_errors open Validation_errors
module Shared = struct module Shared = struct

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "node.state" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "node.worker" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -67,26 +67,6 @@ module Make(S : sig val name: string end) : LOG = struct
end end
module Core = Make(struct let name = "core" end) module Core = Make(struct let name = "core" end)
module P2p = Make(struct let name = "p2p" end)
module RPC = Make(struct let name = "rpc" end)
module Db = Make(struct let name = "db" end)
module Updater = Make(struct let name = "updater" end)
module Node = struct
module State = Make(struct let name = "node.state" end)
module Validator = Make(struct let name = "node.validator" end)
module Prevalidator = Make(struct let name = "node.prevalidator" end)
module Discoverer = Make(struct let name = "node.discoverer" end)
module Worker = Make(struct let name = "node.worker" end)
module Main = Make(struct let name = "node.main" end)
end
module Client = struct
module Blocks = Make(struct let name = "client.blocks" end)
module Baking = Make(struct let name = "client.baking" end)
module Endorsement = Make(struct let name = "client.endorsement" end)
module Revelation = Make(struct let name = "client.revealation" end)
module Denunciation = Make(struct let name = "client.denunciation" end)
module Sign = Make(struct let name = "client.signer" end)
end
type level = Lwt_log_core.level = type level = Lwt_log_core.level =
| Debug | Debug

View File

@ -26,26 +26,6 @@ module type LOG = sig
end end
module Core : LOG module Core : LOG
module P2p : LOG
module RPC : LOG
module Db : LOG
module Updater : LOG
module Node : sig
module State : LOG
module Validator : LOG
module Prevalidator : LOG
module Discoverer : LOG
module Worker : LOG
module Main : LOG
end
module Client : sig
module Blocks : LOG
module Baking : LOG
module Endorsement : LOG
module Revelation : LOG
module Denunciation : LOG
module Sign : LOG
end
module Make(S: sig val name: string end) : LOG module Make(S: sig val name: string end) : LOG

View File

@ -18,7 +18,7 @@ module Make_value (V : ENCODED_VALUE) = struct
let to_bytes v = let to_bytes v =
try Data_encoding.Binary.to_bytes_exn V.encoding v try Data_encoding.Binary.to_bytes_exn V.encoding v
with Data_encoding.Binary.Write_error error -> with Data_encoding.Binary.Write_error error ->
Logging.Node.State.log_error Store_logging.log_error
"Exception while serializing value %a" "Exception while serializing value %a"
Data_encoding.Binary.pp_write_error error ; Data_encoding.Binary.pp_write_error error ;
MBytes.create 0 MBytes.create 0

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.Make(struct let name = "db" end)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Tezos_stdlib.Logging.LOG

View File

@ -7,7 +7,7 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
open Logging.Client.Denunciation include Logging.Make(struct let name = "client.denunciation" end)
let create cctxt endorsement_stream = let create cctxt endorsement_stream =
let last_get_endorsement = ref None in let last_get_endorsement = ref None in

View File

@ -10,7 +10,7 @@
open Proto_alpha open Proto_alpha
open Alpha_context open Alpha_context
open Logging.Client.Endorsement include Logging.Make(struct let name = "client.endorsement" end)
module State : sig module State : sig

View File

@ -10,7 +10,7 @@
open Proto_alpha open Proto_alpha
open Alpha_context open Alpha_context
open Logging.Client.Baking include Logging.Make(struct let name = "client.baking" end)
let generate_proof_of_work_nonce () = let generate_proof_of_work_nonce () =
Rand.generate Constants.proof_of_work_nonce_size Rand.generate Constants.proof_of_work_nonce_size