github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/core/mlog.go (about)

     1  package core
     2  
     3  import (
     4  	"github.com/ethereumproject/go-ethereum/logger"
     5  )
     6  
     7  var mlogBlockchain = logger.MLogRegisterAvailable("blockchain", mLogLinesBlockchain)
     8  var mlogHeaderchain = logger.MLogRegisterAvailable("headerchain", mLogLinesHeaderchain)
     9  var mlogTxPool = logger.MLogRegisterAvailable("txpool", mLogLinesTxPool)
    10  
    11  // mLogLines is an private slice of all available mlog LINES.
    12  // May be used for automatic mlog documentation generator, or
    13  // for API usage/display/documentation otherwise.
    14  var mLogLinesBlockchain = []*logger.MLogT{
    15  	mlogBlockchainWriteBlock,
    16  	mlogBlockchainInsertBlocks,
    17  }
    18  
    19  var mLogLinesHeaderchain = []*logger.MLogT{
    20  	mlogHeaderchainWriteHeader,
    21  	mlogHeaderchainInsertHeaders,
    22  }
    23  
    24  var mLogLinesTxPool = []*logger.MLogT{
    25  	mlogTxPoolAddTx,
    26  	mlogTxPoolValidateTx,
    27  }
    28  
    29  // Collect and document available mlog lines.
    30  
    31  var mlogBlockchainWriteBlock = &logger.MLogT{
    32  	Description: `Called when a single block is written to the chain database.
    33  A STATUS of NONE means it was written _without_ any abnormal chain event, such as a split.`,
    34  	Receiver: "BLOCKCHAIN",
    35  	Verb:     "WRITE",
    36  	Subject:  "BLOCK",
    37  	Details: []logger.MLogDetailT{
    38  		{Owner: "WRITE", Key: "STATUS", Value: "STRING"},
    39  		{Owner: "WRITE", Key: "ERROR", Value: "STRING_OR_NULL"},
    40  		{Owner: "BLOCK", Key: "NUMBER", Value: "BIGINT"},
    41  		{Owner: "BLOCK", Key: "HASH", Value: "STRING"},
    42  		{Owner: "BLOCK", Key: "SIZE", Value: "INT64"},
    43  		{Owner: "BLOCK", Key: "TRANSACTIONS_COUNT", Value: "INT"},
    44  		{Owner: "BLOCK", Key: "GAS_USED", Value: "BIGINT"},
    45  		{Owner: "BLOCK", Key: "COINBASE", Value: "STRING"},
    46  		{Owner: "BLOCK", Key: "TIME", Value: "BIGINT"},
    47  		{Owner: "BLOCK", Key: "DIFFICULTY", Value: "BIGINT"},
    48  		{Owner: "BLOCK", Key: "UNCLES", Value: "INT"},
    49  		{Owner: "BLOCK", Key: "RECEIVED_AT", Value: "BIGINT"},
    50  		{Owner: "BLOCK", Key: "DIFF_PARENT_TIME", Value: "BIGINT"},
    51  	},
    52  }
    53  
    54  var mlogBlockchainInsertBlocks = &logger.MLogT{
    55  	Description: "Called when a chain of blocks is inserted into the chain database.",
    56  	Receiver:    "BLOCKCHAIN",
    57  	Verb:        "INSERT",
    58  	Subject:     "BLOCKS",
    59  	Details: []logger.MLogDetailT{
    60  		{Owner: "BLOCKS", Key: "COUNT", Value: "INT"},
    61  		{Owner: "BLOCKS", Key: "QUEUED", Value: "INT"},
    62  		{Owner: "BLOCKS", Key: "IGNORED", Value: "INT"},
    63  		{Owner: "BLOCKS", Key: "TRANSACTIONS_COUNT", Value: "INT"},
    64  		{Owner: "BLOCKS", Key: "LAST_NUMBER", Value: "BIGINT"},
    65  		{Owner: "BLOCKS", Key: "FIRST_HASH", Value: "STRING"},
    66  		{Owner: "BLOCKS", Key: "LAST_HASH", Value: "STRING"},
    67  		{Owner: "INSERT", Key: "TIME", Value: "DURATION"},
    68  	},
    69  }
    70  
    71  var mlogBlockchainReorgBlocks = &logger.MLogT{
    72  	Description: "Called when a chain split is detected and a subset of blocks are reoganized.",
    73  	Receiver:    "BLOCKCHAIN",
    74  	Verb:        "REORG",
    75  	Subject:     "BLOCKS",
    76  	Details: []logger.MLogDetailT{
    77  		{Owner: "REORG", Key: "LAST_COMMON_HASH", Value: "STRING"},
    78  		{Owner: "REORG", Key: "SPLIT_NUMBER", Value: "BIGINT"},
    79  		{Owner: "BLOCKS", Key: "OLD_START_HASH", Value: "STRING"},
    80  		{Owner: "BLOCKS", Key: "NEW_START_HASH", Value: "STRING"},
    81  	},
    82  }
    83  
    84  // Headerchain
    85  var mlogHeaderchainWriteHeader = &logger.MLogT{
    86  	Description: `Called when a single header is written to the chain header database.
    87  A STATUS of NONE means it was written _without_ any abnormal chain event, such as a split.`,
    88  	Receiver: "HEADERCHAIN",
    89  	Verb:     "WRITE",
    90  	Subject:  "HEADER",
    91  	Details: []logger.MLogDetailT{
    92  		{Owner: "WRITE", Key: "STATUS", Value: "STRING"},
    93  		{Owner: "WRITE", Key: "ERROR", Value: "STRING_OR_NULL"},
    94  		{Owner: "HEADER", Key: "NUMBER", Value: "BIGINT"},
    95  		{Owner: "HEADER", Key: "HASH", Value: "STRING"},
    96  		{Owner: "HEADER", Key: "GAS_USED", Value: "BIGINT"},
    97  		{Owner: "HEADER", Key: "COINBASE", Value: "STRING"},
    98  		{Owner: "HEADER", Key: "TIME", Value: "BIGINT"},
    99  		{Owner: "HEADER", Key: "DIFFICULTY", Value: "BIGINT"},
   100  		{Owner: "HEADER", Key: "DIFF_PARENT_TIME", Value: "BIGINT"},
   101  	},
   102  }
   103  
   104  var mlogHeaderchainInsertHeaders = &logger.MLogT{
   105  	Description: "Called when a chain of headers is inserted into the chain header database.",
   106  	Receiver:    "HEADERCHAIN",
   107  	Verb:        "INSERT",
   108  	Subject:     "HEADERS",
   109  	Details: []logger.MLogDetailT{
   110  		{Owner: "HEADERS", Key: "COUNT", Value: "INT"},
   111  		{Owner: "HEADERS", Key: "IGNORED", Value: "INT"},
   112  		{Owner: "HEADERS", Key: "LAST_NUMBER", Value: "BIGINT"},
   113  		{Owner: "HEADERS", Key: "FIRST_HASH", Value: "STRING"},
   114  		{Owner: "HEADERS", Key: "LAST_HASH", Value: "STRING"},
   115  		{Owner: "INSERT", Key: "TIME", Value: "DURATION"},
   116  	},
   117  }
   118  
   119  var mlogTxPoolAddTx = &logger.MLogT{
   120  	Description: `Called once when a valid transaction is added to tx pool.
   121  $TO.NAME will be the account address hex or '[NEW_CONTRACT]' in case of a contract.`,
   122  	Receiver: "TXPOOL",
   123  	Verb:     "ADD",
   124  	Subject:  "TX",
   125  	Details: []logger.MLogDetailT{
   126  		{Owner: "TX", Key: "FROM", Value: "STRING"},
   127  		{Owner: "TX", Key: "TO", Value: "STRING"},
   128  		{Owner: "TX", Key: "VALUE", Value: "BIGINT"},
   129  		{Owner: "TX", Key: "HASH", Value: "STRING"},
   130  	},
   131  }
   132  
   133  var mlogTxPoolValidateTx = &logger.MLogT{
   134  	Description: `Called once when validating a single transaction.
   135  If transaction is invalid, TX.ERROR will be non-nil, otherwise it will be nil.`,
   136  	Receiver: "TXPOOL",
   137  	Verb:     "VALIDATE",
   138  	Subject:  "TX",
   139  	Details: []logger.MLogDetailT{
   140  		{Owner: "TX", Key: "HASH", Value: "STRING"},
   141  		{Owner: "TX", Key: "SIZE", Value: "QUOTEDSTRING"},
   142  		{Owner: "TX", Key: "DATA_SIZE", Value: "QUOTEDSTRING"},
   143  		{Owner: "TX", Key: "NONCE", Value: "INT"},
   144  		{Owner: "TX", Key: "GAS", Value: "BIGINT"},
   145  		{Owner: "TX", Key: "GAS_PRICE", Value: "BIGINT"},
   146  		{Owner: "TX", Key: "VALID", Value: "BOOL"},
   147  		{Owner: "TX", Key: "ERROR", Value: "STRING_OR_NULL"},
   148  	},
   149  }