Skip to content

Commit aaed952

Browse files
author
Seung Woo Kim
committed
Add information in manual about logging
1 parent d914428 commit aaed952

File tree

1 file changed

+103
-44
lines changed

1 file changed

+103
-44
lines changed

docs/configuration.rst

Lines changed: 103 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,99 +30,158 @@ In order to test CodeChain alone, one may want to change ``change_type`` into So
3030

3131
CLI Options for CodeChain client
3232
================================
33-
::
34-
35-
--config-path = [PATH]
33+
``--config-path=[PATH]``
3634
Specify the certain config file path that you want to use to configure CodeChain to your needs.
3735

38-
--port = [PORT]
36+
``--port=[PORT]``
3937
Listen for connections on PORT. (default: 3485)
4038

41-
--bootstrap-addresses = [BOOTSTRAP_ADDRESSES]
39+
``--bootstrap-addresses=[BOOTSTRAP_ADDRESSES]``
4240
Bootstrap addresses to connect.
4341

44-
--no-network
42+
``--no-network``
4543
Do not open network socket.
4644

47-
--min-peers = [NUM]
45+
``--min-peers=[NUM]``
4846
Sets the minimum number of connections the user would like. (default: 10)
4947

50-
--max-peers = [NUM]
48+
``--max-peers=[NUM]``
5149
Sets the maximum number of connections the user would like. (default: 30)
5250

53-
--instance-id = [ID]
51+
``--instance-id=[ID]``
5452
Specify instance id for logging. Used when running multiple instances of CodeChain.
5553

56-
--quiet
54+
``--quiet``
5755
Do not show any synchronization information in the console.
5856

59-
--chain = [CHAIN]
57+
``--chain=[CHAIN]``
6058
Sets the blockchain type out of solo, solo_authority, tendermint or a path to chain spec file. (default: tendermint)
6159

62-
--db-path = [PATH]
60+
``--db-path=[PATH]``
6361
Specify the database directory path.
6462

65-
--no-sync
63+
``--no-sync``
6664
Do not run block sync extension.
6765

68-
--no-parcel-relay
66+
``--no-parcel-relay``
6967
Do not relay parcels.
7068

71-
--jsonrpc-port = [PORT]
69+
``--jsonrpc-port=[PORT]``
7270
Listen for rpc connections on PORT. (default: 8080)
7371

74-
--no-jsonrpc
72+
``--no-jsonrpc``
7573
Do not run jsonrpc.
7674

77-
--secret-key = [KEY]
75+
``--secret-key=[KEY]``
7876
Secret key used by node.
7977

80-
--author = [ADDRESS]
78+
``--author=[ADDRESS]``
8179
Specify the block's author (aka "coinbase") address for sending block rewards from
8280
sealed blocks.
8381

84-
--engine-signer = [ADDRESS]
82+
``--engine-signer=[ADDRESS]``
8583
Specify the address which should be used to sign consensus messages and
8684
issue blocks.
8785

88-
--no-discovery
86+
``--no-discovery``
8987
Do not use discovery. No automated peer finding.
9088

91-
--discovery = "kademlia" | "unstructured"
92-
Decides which p2p discovery extension to use. Options are kademlia and unstructured.
89+
``--discovery="kademlia" | "unstructured"``
90+
Decides which p2p discovery extension to use. Options are `kademlia <https://github.com/CodeChain-io/codechain/wiki/Kademlia-Extension>`_ and unstructured.
91+
In a testing environment, an unstructured p2p network is desirable because it is
92+
more than sufficient when there are a few users.
9393
(default: unstructured)
9494

95-
--discovery-bucket-size = [NUM]
95+
``--discovery-bucket-size=[NUM]``
9696
Bucket size for discovery. Choose how many addresses to exchange at a time
9797
during discovery.
9898

99-
--discovery-refresh = [ms]
99+
``--discovery-refresh=[ms]``
100100
Refresh timeout of discovery (ms). It may conflict with:`` --no-discovery``.
101101

102-
Subcommands
102+
Subcommands
103+
-----------
104+
105+
CodeChain has a subcommand called ``account``. It has subcommands of its own, which are the following:
106+
107+
``create``
108+
create account
109+
110+
``--passphrase <PASSWORD>``
111+
account passphrase
112+
113+
``import``
114+
import private key
115+
116+
``--passphrase <PASSWORD>``
117+
set account passphrase
118+
119+
``--raw-key <RAW-KEY>``
120+
specify key to import
121+
122+
``list``
123+
list managed accounts
124+
125+
For example, if you want to create an account with a password of '1234', run the following:
126+
::
103127

104-
CodeChain has a subcommand called ``account``. ``amount``is the account managing commands
105-
of CodeChain, and also has subcommands of its own, which are the following:
128+
./target/release/codechain account create --passphrase 1234
106129

107-
Subcommands of codechain account:
108-
create
109-
create account
110-
--passphrase = []
111-
account passphrase
112130

113-
import
114-
import private key
115-
--passphrase = []
116-
account passphrase
131+
Logging
132+
=======
133+
For logging, run the following to configure:
134+
``$ RUST_LOG=<level> codechain``
117135

118-
--raw-key = []
119-
key to import
136+
Log Levels
137+
----------
138+
CodeChain currently offers five different ``<level>``. They are error, warn, info, debug, and trace.
120139

121-
list
122-
list managed accounts
140+
For example, the log level will be set to debug, if you run the following:
123141

124-
lock
125-
lock account
142+
``$ RUST_LOG="debug" codechain``
143+
144+
* The **error** level represents an event where something can be dangerous, but can still run. In the case in which it cannot run anymore, it must crash ASAP instead of logging.
145+
146+
* The **warn** level represents an event which can be potentially dangerous.
147+
148+
* The **info** level represents an event which is not dangerous, but can be useful information for users.
149+
150+
* The **debug** level represents an event that is useful for developers, but not for users.
151+
152+
* The **trace** level is used for tracing.
153+
154+
Log Targets
155+
-----------
156+
157+
Log levels can be set differently for each log targets. For example, you can run the following to set ``tx``'s log level as ``trace`` and ``parcel``'s
158+
log level as ``info`` with the following code:
159+
160+
``$ RUST_LOG="tx=trace, parcel=info" codechain``
161+
162+
The possible log targets are as follows:
163+
::
126164

127-
unlock
128-
unlock account
165+
"blockchain"
166+
"client"
167+
"discovery"
168+
"engine"
169+
"external_parcel"
170+
"io"
171+
"miner"
172+
"net"
173+
"netapi"
174+
"own_parcel"
175+
"parcel_queue"
176+
"poa"
177+
"shutdown"
178+
"snapshot"
179+
"solo_authoirty"
180+
"spec"
181+
"state"
182+
"state_db"
183+
"stratum"
184+
"sync"
185+
"test_script"
186+
"trie"
187+
"tx"

0 commit comments

Comments
 (0)