Documentation ¶
Overview ¶
Package progresslog provides periodic logging for block processing.
Tests are included to ensure proper functionality.
Feature Overview ¶
The following are the primary features provided:
- Maintains cumulative totals about blocks between each logging interval
- Logs all cumulative data every 10 seconds
- Immediately logs any outstanding data when requested by the caller
The cumulative totals include:
- Total number of blocks
- Total number of transactions
- Total number of votes
- Total number of tickets
- Total number of revocations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
Logger provides periodic logging of progress towards some action such as syncing the chain.
func (*Logger) LogHeaderProgress ¶
func (l *Logger) LogHeaderProgress(processedHeaders uint64, forceLog bool, progressFn func() float64)
LogHeaderProgress accumulates the provided number of processed headers and periodically (every 10 seconds) logs an information message to show the header sync progress to the user along with duration and totals included.
The force flag may be used to force a log message to be shown regardless of the time the last one was shown.
The progress message is templated as follows:
{progressAction} {numProcessed} {headers|header} in the last {timePeriod} (progress {progress}%)
This function is safe for concurrent access.
func (*Logger) LogProgress ¶
LogProgress accumulates details for the provided block and periodically (every 10 seconds) logs an information message to show progress to the user along with duration and totals included.
The force flag may be used to force a log message to be shown regardless of the time the last one was shown.
The progress message is templated as follows:
{progressAction} {numProcessed} {blocks|block} in the last {timePeriod} ({numTxs} {transactions|transaction}, {numTickets} {tickets|ticket}, {numVotes} {votes|vote}, {numRevocations} {revocations|revocation}, height {lastBlockHeight}, progress {progress}%)
This function is safe for concurrent access.
func (*Logger) SetLastLogTime ¶
SetLastLogTime updates the last time data was logged to the provided time.
This function is safe for concurrent access.