Documentation ¶
Index ¶
- Constants
- Variables
- func CloseIteratorError(log *Log, err error)
- func CloseResponseBodyError(log *Log, err error)
- func GetSpec() string
- func InvalidParameterValue(log *Log, param string, err error)
- func ReadRequestBodyError(log *Log, err error)
- func SetDefaultLevel(level Level)
- func SetLevel(module string, level Level)
- func SetSpec(spec string) error
- func WithAcceptListType(value string) zap.Field
- func WithActivityID(value fmt.Stringer) zap.Field
- func WithActivityType(value string) zap.Field
- func WithActorID(value string) zap.Field
- func WithActorIRI(value fmt.Stringer) zap.Field
- func WithAddress(value string) zap.Field
- func WithAge(value time.Duration) zap.Field
- func WithAnchorCID(value string) zap.Field
- func WithAnchorEventURI(value fmt.Stringer) zap.Field
- func WithAnchorEventURIString(value string) zap.Field
- func WithAnchorHash(value string) zap.Field
- func WithAnchorLink(value []byte) zap.Field
- func WithAnchorLinkset(value []byte) zap.Field
- func WithAnchorOrigin(value interface{}) zap.Field
- func WithAnchorOriginEndpoint(value interface{}) zap.Field
- func WithAnchorString(value string) zap.Field
- func WithAnchorURI(value fmt.Stringer) zap.Field
- func WithAnchorURIString(value string) zap.Field
- func WithAnchorURIStrings(value ...string) zap.Field
- func WithAttributedTo(value string) zap.Field
- func WithAuthToken(value string) zap.Field
- func WithAuthTokens(value ...string) zap.Field
- func WithBackoff(value time.Duration) zap.Field
- func WithCASData(value []byte) zap.Field
- func WithCID(value string) zap.Field
- func WithCIDVersion(value int) zap.Field
- func WithCacheExpiration(value time.Duration) zap.Field
- func WithCanonicalRef(value string) zap.Field
- func WithConfig(value interface{}) zap.Field
- func WithCoreIndex(value string) zap.Field
- func WithCreatedTime(value time.Time) zap.Field
- func WithCurrentIRI(value fmt.Stringer) zap.Field
- func WithDID(value string) zap.Field
- func WithData(value []byte) zap.Field
- func WithDeliveryAttempts(value int) zap.Field
- func WithDeliveryDelay(value time.Duration) zap.Field
- func WithDomain(value string) zap.Field
- func WithDuration(value time.Duration) zap.Field
- func WithError(err error) zap.Field
- func WithFromIndexUint64(value uint64) zap.Field
- func WithGenesisTime(value uint64) zap.Field
- func WithHRef(value string) zap.Field
- func WithHTTPMethod(value string) zap.Field
- func WithHTTPStatus(value int) zap.Field
- func WithHash(value string) zap.Field
- func WithHashlink(value string) zap.Field
- func WithHashlinkURI(value fmt.Stringer) zap.Field
- func WithID(value string) zap.Field
- func WithIndex(value int) zap.Field
- func WithIndexUint64(value uint64) zap.Field
- func WithIssuer(value string) zap.Field
- func WithJRD(value interface{}) zap.Field
- func WithKey(value string) zap.Field
- func WithKeyID(value string) zap.Field
- func WithKeyIRI(value fmt.Stringer) zap.Field
- func WithKeyOwnerIRI(value fmt.Stringer) zap.Field
- func WithKeyType(value string) zap.Field
- func WithLink(value string) zap.Field
- func WithLinks(value ...string) zap.Field
- func WithLocalHashlink(value string) zap.Field
- func WithLogMonitor(value interface{}) zap.Field
- func WithLogMonitors(value interface{}) zap.Field
- func WithLogURL(value fmt.Stringer) zap.Field
- func WithLogURLString(value string) zap.Field
- func WithMaxRetries(value int) zap.Field
- func WithMaxSize(value int) zap.Field
- func WithMaxSizeUInt64(value uint64) zap.Field
- func WithMaxTime(value time.Duration) zap.Field
- func WithMessageID(value string) zap.Field
- func WithMetadata(value interface{}) zap.Field
- func WithMinAge(value time.Duration) zap.Field
- func WithMinimum(value int) zap.Field
- func WithMultihash(value string) zap.Field
- func WithNamespace(value string) zap.Field
- func WithNextIRI(value fmt.Stringer) zap.Field
- func WithObjectIRI(value fmt.Stringer) zap.Field
- func WithOperation(value interface{}) zap.Field
- func WithOperationID(value string) zap.Field
- func WithOperationType(value string) zap.Field
- func WithOriginActorID(value string) zap.Field
- func WithParameter(value string) zap.Field
- func WithParameters(value interface{}) zap.Field
- func WithParent(value string) zap.Field
- func WithParentURI(value fmt.Stringer) zap.Field
- func WithParents(value []string) zap.Field
- func WithPermitHolder(value string) zap.Field
- func WithProof(value []byte) zap.Field
- func WithProofDocument(value map[string]interface{}) zap.Field
- func WithProperty(value string) zap.Field
- func WithQuery(value interface{}) zap.Field
- func WithReferenceIRI(value fmt.Stringer) zap.Field
- func WithReferenceType(value string) zap.Field
- func WithRequestBody(value []byte) zap.Field
- func WithRequestHeaders(value http.Header) zap.Field
- func WithRequestURL(value fmt.Stringer) zap.Field
- func WithRequestURLString(value string) zap.Field
- func WithResolutionEndpoints(value ...string) zap.Field
- func WithResolutionModel(value interface{}) zap.Field
- func WithResolutionResult(value interface{}) zap.Field
- func WithResolvedCID(value string) zap.Field
- func WithResource(value string) zap.Field
- func WithResponse(value []byte) zap.Field
- func WithRetries(value int) zap.Field
- func WithSenderURL(value fmt.Stringer) zap.Field
- func WithServiceEndpoint(value string) zap.Field
- func WithServiceIRI(value fmt.Stringer) zap.Field
- func WithServiceName(value string) zap.Field
- func WithSidetreeProtocol(value interface{}) zap.Field
- func WithSidetreeTxn(value interface{}) zap.Field
- func WithSize(value int) zap.Field
- func WithSizeUint64(value uint64) zap.Field
- func WithSource(value string) zap.Field
- func WithStatus(value string) zap.Field
- func WithStoreName(value string) zap.Field
- func WithSubscriberPoolSize(value int) zap.Field
- func WithSuffix(value string) zap.Field
- func WithSuffixes(value ...string) zap.Field
- func WithTarget(value string) zap.Field
- func WithTargetIRI(value fmt.Stringer) zap.Field
- func WithTargetIRIs(value ...*url.URL) zap.Field
- func WithTaskExpiration(value time.Duration) zap.Field
- func WithTaskID(value string) zap.Field
- func WithTaskMgrInstanceID(value string) zap.Field
- func WithTaskMonitorInterval(value time.Duration) zap.Field
- func WithTimeSinceLastUpdate(value time.Duration) zap.Field
- func WithTimeout(value time.Duration) zap.Field
- func WithToIndexUint64(value uint64) zap.Field
- func WithTopic(value string) zap.Field
- func WithTotal(value int) zap.Field
- func WithType(value string) zap.Field
- func WithURI(value fmt.Stringer) zap.Field
- func WithURIString(value string) zap.Field
- func WithURIs(value ...*url.URL) zap.Field
- func WithURL(value fmt.Stringer) zap.Field
- func WithURLAdditions(value ...*url.URL) zap.Field
- func WithURLDeletions(value ...*url.URL) zap.Field
- func WithURLString(value string) zap.Field
- func WithValue(value interface{}) zap.Field
- func WithVerifiableCredential(value []byte) zap.Field
- func WithVerifiableCredentialID(value string) zap.Field
- func WithVersion(value string) zap.Field
- func WithWitnessPolicy(value string) zap.Field
- func WithWitnessURI(value fmt.Stringer) zap.Field
- func WithWitnessURIString(value string) zap.Field
- func WithWitnessURIStrings(value ...string) zap.Field
- func WithWitnessURIs(value ...*url.URL) zap.Field
- func WriteResponseBodyError(log *Log, err error)
- func WroteResponse(log *Log, data []byte)
- type Encoding
- type Level
- type Log
- type ObjectMarshaller
- type Option
- type StringArrayMarshaller
- type URLArrayMarshaller
Constants ¶
const ( FieldURI = "uri" FieldURIs = "uris" FieldURL = "url" FieldSenderURL = "sender" FieldConfig = "config" FieldServiceName = "service" FieldServiceIRI = "serviceIri" FieldServiceEndpoint = "serviceEndpoint" FieldActorID = "actorId" FieldOriginActorID = "originActorId" FieldActivityType = "activityType" FieldActivityID = "activityId" FieldMessageID = "messageId" FieldData = "data" FieldMetadata = "metadata" FieldRequestURL = "requestUrl" FieldRequestHeaders = "requestHeaders" FieldRequestBody = "requestBody" FieldResponse = "response" FieldSize = "size" FieldMaxSize = "maxSize" FieldCacheExpiration = "cacheExpiration" FieldTarget = "target" FieldTargets = "targets" FieldTopic = "topic" FieldHTTPStatus = "httpStatus" FieldHTTPMethod = "httpMethod" FieldParameter = "parameter" FieldParameters = "parameters" FieldAcceptListType = "acceptListType" FieldAdditions = "additions" FieldDeletions = "deletions" FieldReferenceType = "referenceType" FieldAnchorURI = "anchorUri" FieldAnchorURIs = "anchorURIs" FieldAnchorHash = "anchorHash" FieldAnchorEventURI = "anchorEventUri" FieldObjectIRI = "objectIri" FieldReferenceIRI = "reference" FieldKeyID = "keyId" FieldKeyType = "keyType" FieldKeyOwner = "keyOwner" FieldCurrent = "current" FieldNext = "next" FieldTotal = "total" FieldMinimum = "minimum" FieldType = "type" FieldQuery = "query" FieldSuffix = "suffix" FieldSuffixes = "suffixes" FieldVerifiableCredential = "vc" FieldVerifiableCredentialID = "vcId" FieldHash = "hash" FieldHashlink = "hashlink" FieldLocalHashlink = "localHashlink" FieldParent = "parent" FieldParents = "parents" FieldProof = "proof" FieldCreatedTime = "createdTime" FieldWitnessURI = "witnessUri" FieldWitnessURIs = "witnessURIs" FieldWitnessPolicy = "witnessPolicy" FieldAnchorOrigin = "anchorOrigin" FieldAnchorOriginEndpoint = "anchorOriginEndpoint" FieldOperationType = "operationType" FieldOperation = "operation" FieldCoreIndex = "coreIndex" FieldKey = "key" FieldValue = "value" FieldCID = "cid" FieldResolvedCID = "resolvedCid" FieldAnchorCID = "anchorCid" FieldCIDVersion = "cidVersion" FieldMultihash = "multihash" FieldCASData = "casData" FieldDomain = "domain" FieldLink = "link" FieldLinks = "links" FieldTaskMgrInstanceID = "taskMgrInstanceId" FieldTaskID = "taskId" FieldRetries = "retries" FieldMaxRetries = "maxRetries" FieldSubscriberPoolSize = "subscriberPoolSize" FieldTaskMonitorInterval = "taskMonitorInterval" FieldTaskExpiration = "taskExpiration" FieldDeliveryDelay = "deliveryDelay" FieldOperationID = "operationId" FieldPermitHolder = "permitHolder" FieldTimeSinceLastUpdate = "timeSinceLastUpdate" FieldGenesisTime = "genesisTime" FieldSidetreeProtocol = "sidetreeProtocol" FieldSidetreeTxn = "sidetreeTxn" FieldDID = "did" FieldHRef = "href" FieldID = "id" FieldResource = "resource" FieldResolutionResult = "resolutionResult" FieldResolutionModel = "resolutionModel" FieldResolutionEndpoints = "resolutionEndpoints" FieldAuthToken = "authToken" FieldAuthTokens = "authTokens" FieldAddress = "address" FieldAttributedTo = "attributedTo" FieldAnchorLink = "anchorLink" FieldAnchorLinkset = "anchorLinkset" FieldVersion = "version" FieldDeliveryAttempts = "deliveryAttempts" FieldProperty = "property" FieldStorageName = "storeName" FieldIssuer = "issuer" FieldStatus = "status" FieldLogURL = "logURL" FieldNamespace = "namespace" FieldCanonicalRef = "canonicalRef" FieldAnchorString = "anchorString" FieldJRD = "jrd" FieldBackoff = "backoff" FieldTimeout = "timeout" FieldMaxTime = "maxTime" FieldLogMonitor = "logMonitor" FieldLogMonitors = "logMonitors" FieldIndex = "index" FieldFromIndex = "fromIndex" FieldToIndex = "toIndex" FieldSource = "source" FieldAge = "age" FieldMinAge = "minAge" FieldDuration = "duration" )
Log Fields.
const ( DEBUG = Level(zapcore.DebugLevel) INFO = Level(zapcore.InfoLevel) WARNING = Level(zapcore.WarnLevel) ERROR = Level(zapcore.ErrorLevel) PANIC = Level(zapcore.PanicLevel) FATAL = Level(zapcore.FatalLevel) )
Log levels.
Variables ¶
var DefaultEncoding = Console
DefaultEncoding sets the default logger encoding. It may be overridden at build time using the -ldflags option.
Functions ¶
func CloseIteratorError ¶
CloseIteratorError outputs a 'close iterator' error log to the given logger.
func CloseResponseBodyError ¶
CloseResponseBodyError outputs a 'close response body' error log to the given logger.
func GetSpec ¶
func GetSpec() string
GetSpec returns the log spec which specifies the log level of each individual module. The spec is in the following format:
module1=level1:module2=level2:module3=level3:defaultLevel
Example:
module1=error:module2=debug:module3=warning:info
func InvalidParameterValue ¶
InvalidParameterValue outputs an 'invalid parameter' log to the given logger.
func ReadRequestBodyError ¶
ReadRequestBodyError outputs a 'read response body' error log to the given logger.
func SetDefaultLevel ¶
func SetDefaultLevel(level Level)
SetDefaultLevel sets the default log level.
func SetSpec ¶
SetSpec sets the log levels for individual modules as well as the default log level. The format of the spec is as follows:
module1=level1:module2=level2:module3=level3:defaultLevel
Valid log levels are: critical, error, warning, info, debug
Example:
module1=error:module2=debug:module3=warning:info
func WithAcceptListType ¶
WithAcceptListType sets the accept-list-type field.
func WithActivityID ¶
WithActivityID sets the activity-id field.
func WithActivityType ¶
WithActivityType sets the activity-type field.
func WithActorIRI ¶
WithActorIRI sets the actor-id field.
func WithAnchorCID ¶
WithAnchorCID sets the anchor-cid field.
func WithAnchorEventURI ¶
WithAnchorEventURI sets the anchor-event-uri field.
func WithAnchorEventURIString ¶
WithAnchorEventURIString sets the anchor-event-uri field.
func WithAnchorHash ¶
WithAnchorHash sets the anchor-hash field.
func WithAnchorLink ¶
WithAnchorLink sets the anchor-link field.
func WithAnchorLinkset ¶
WithAnchorLinkset sets the anchor-linkset field.
func WithAnchorOrigin ¶
WithAnchorOrigin sets the anchor-origin field.
func WithAnchorOriginEndpoint ¶
WithAnchorOriginEndpoint sets the anchor-origin-endpoint field.
func WithAnchorString ¶
WithAnchorString sets the anchor-string field.
func WithAnchorURI ¶
WithAnchorURI sets the anchor-uri field.
func WithAnchorURIString ¶
WithAnchorURIString sets the anchor-uri field.
func WithAnchorURIStrings ¶
WithAnchorURIStrings sets the anchor-uris field.
func WithAttributedTo ¶
WithAttributedTo sets the attributed-to field.
func WithAuthToken ¶
WithAuthToken sets the auth-token field.
func WithAuthTokens ¶
WithAuthTokens sets the auth-tokens field.
func WithBackoff ¶
WithBackoff sets the backoff field.
func WithCIDVersion ¶
WithCIDVersion sets the cid-version field.
func WithCacheExpiration ¶
WithCacheExpiration sets the cache-expiration field.
func WithCanonicalRef ¶
WithCanonicalRef sets the canonical-ref field.
func WithConfig ¶
WithConfig sets the config field. The value of the field is encoded as JSON.
func WithCoreIndex ¶
WithCoreIndex sets the coreIndex field.
func WithCreatedTime ¶
WithCreatedTime sets the created-time field.
func WithCurrentIRI ¶
WithCurrentIRI sets the current field.
func WithDeliveryAttempts ¶
WithDeliveryAttempts sets the delivery-attempts field.
func WithDeliveryDelay ¶
WithDeliveryDelay sets the delivery-delay field.
func WithDuration ¶
WithDuration sets the duration field.
func WithFromIndexUint64 ¶
WithFromIndexUint64 sets the from-index field.
func WithGenesisTime ¶
WithGenesisTime sets the genesis-time field.
func WithHTTPMethod ¶
WithHTTPMethod sets the http-method field.
func WithHTTPStatus ¶
WithHTTPStatus sets the http-status field.
func WithHashlinkURI ¶
WithHashlinkURI sets the hashlink field.
func WithIndexUint64 ¶
WithIndexUint64 sets the index field.
func WithKeyOwnerIRI ¶
WithKeyOwnerIRI sets the key-owner field.
func WithLocalHashlink ¶
WithLocalHashlink sets the local-hashlink field.
func WithLogMonitor ¶
WithLogMonitor sets the log-monitor field.
func WithLogMonitors ¶
WithLogMonitors sets the log-monitors field.
func WithLogURLString ¶
WithLogURLString sets the log-url field.
func WithMaxRetries ¶
WithMaxRetries sets the max-retries field.
func WithMaxSizeUInt64 ¶
WithMaxSizeUInt64 sets the max-size field.
func WithMaxTime ¶
WithMaxTime sets the max-time field.
func WithMessageID ¶
WithMessageID sets the message-id field.
func WithMetadata ¶
WithMetadata sets the metadata field.
func WithMultihash ¶
WithMultihash sets the multihash field.
func WithNamespace ¶
WithNamespace sets the namespace field.
func WithObjectIRI ¶
WithObjectIRI sets the object-iri field.
func WithOperation ¶
WithOperation sets the operation field.
func WithOperationID ¶
WithOperationID sets the operation-id field.
func WithOperationType ¶
WithOperationType sets the operation-type field.
func WithOriginActorID ¶
WithOriginActorID sets the origin-actor-id field.
func WithParameter ¶
WithParameter sets the parameter field.
func WithParameters ¶
WithParameters sets the parameters field.
func WithParentURI ¶
WithParentURI sets the parent field.
func WithPermitHolder ¶
WithPermitHolder sets the permit-holder field.
func WithProofDocument ¶
WithProofDocument sets the proof field.
func WithReferenceIRI ¶
WithReferenceIRI sets the reference field.
func WithReferenceType ¶
WithReferenceType sets the reference-type field.
func WithRequestBody ¶
WithRequestBody sets the request-body field.
func WithRequestHeaders ¶
WithRequestHeaders sets the request-headers field.
func WithRequestURL ¶
WithRequestURL sets the request-url field.
func WithRequestURLString ¶
WithRequestURLString sets the request-url field.
func WithResolutionEndpoints ¶
WithResolutionEndpoints sets the resolution-endpoints field.
func WithResolutionModel ¶
WithResolutionModel sets the resolution-model field.
func WithResolutionResult ¶
WithResolutionResult sets the resolution-result field.
func WithResolvedCID ¶
WithResolvedCID sets the resolved-cid field.
func WithSenderURL ¶
WithSenderURL sets the sender field.
func WithServiceEndpoint ¶
WithServiceEndpoint sets the service-endpoint field.
func WithServiceIRI ¶
WithServiceIRI sets the service-iri field.
func WithServiceName ¶
WithServiceName sets the service field.
func WithSidetreeProtocol ¶
WithSidetreeProtocol sets the sidetree-protocol field.
func WithSidetreeTxn ¶
WithSidetreeTxn sets the sidetree-txn field.
func WithSizeUint64 ¶
WithSizeUint64 sets the size field.
func WithStoreName ¶
WithStoreName sets the store-name field.
func WithSubscriberPoolSize ¶
WithSubscriberPoolSize sets the subscriber-pool-size field.
func WithSuffixes ¶
WithSuffixes sets the suffixes field.
func WithTargetIRI ¶
WithTargetIRI sets the target field.
func WithTargetIRIs ¶
WithTargetIRIs sets the targets field.
func WithTaskExpiration ¶
WithTaskExpiration sets the task-expiration field.
func WithTaskMgrInstanceID ¶
WithTaskMgrInstanceID sets the task-mgr-instance field.
func WithTaskMonitorInterval ¶
WithTaskMonitorInterval sets the task-monitor-interval field.
func WithTimeSinceLastUpdate ¶
WithTimeSinceLastUpdate sets the time-since-last-update field.
func WithTimeout ¶
WithTimeout sets the timeout field.
func WithToIndexUint64 ¶
WithToIndexUint64 sets the to-index field.
func WithURLAdditions ¶
WithURLAdditions sets the additions field.
func WithURLDeletions ¶
WithURLDeletions sets the deletions field.
func WithVerifiableCredential ¶
WithVerifiableCredential sets the vc field.
func WithVerifiableCredentialID ¶
WithVerifiableCredentialID sets the vc-id field.
func WithWitnessPolicy ¶
WithWitnessPolicy sets the witness-policy field.
func WithWitnessURI ¶
WithWitnessURI sets the witness-uri field.
func WithWitnessURIString ¶
WithWitnessURIString sets the witness-uri field.
func WithWitnessURIStrings ¶
WithWitnessURIStrings sets the witness-uris field.
func WithWitnessURIs ¶
WithWitnessURIs sets the witness-uris field.
func WriteResponseBodyError ¶
WriteResponseBodyError outputs a 'write response body' error log to the given logger.
func WroteResponse ¶
WroteResponse outputs a 'wrote response' log to the given logger.
Types ¶
type Level ¶
type Level int
Level defines a log level for logging messages.
func ParseLevel ¶
ParseLevel returns the level from the given string.
type Log ¶
Log uses the Zap Logger to log messages in a structured way.
type ObjectMarshaller ¶
type ObjectMarshaller struct {
// contains filtered or unexported fields
}
ObjectMarshaller uses reflection to marshal an object's fields.
func NewObjectMarshaller ¶
func NewObjectMarshaller(key string, obj interface{}) *ObjectMarshaller
NewObjectMarshaller returns a new ObjectMarshaller.
func (*ObjectMarshaller) MarshalLogObject ¶
func (m *ObjectMarshaller) MarshalLogObject(e zapcore.ObjectEncoder) error
MarshalLogObject marshals the object's fields.
type Option ¶
type Option func(o *options)
Option is a logger option.
func WithEncoding ¶
WithEncoding sets the output encoding (console or json).
func WithFields ¶
WithFields sets the fields that will be output with every log.
func WithStdErr ¶
func WithStdErr(stdErr zapcore.WriteSyncer) Option
WithStdErr sets the output for logs of type ERROR, PANIC, and FATAL.
func WithStdOut ¶
func WithStdOut(stdOut zapcore.WriteSyncer) Option
WithStdOut sets the output for logs of type DEBUG, INFO, and WARN.
type StringArrayMarshaller ¶
type StringArrayMarshaller struct {
// contains filtered or unexported fields
}
StringArrayMarshaller marshals an array of strings into a log field.
func NewStringArrayMarshaller ¶
func NewStringArrayMarshaller(values []string) *StringArrayMarshaller
NewStringArrayMarshaller returns a new StringArrayMarshaller.
func (*StringArrayMarshaller) MarshalLogArray ¶
func (m *StringArrayMarshaller) MarshalLogArray(e zapcore.ArrayEncoder) error
MarshalLogArray marshals the array.
type URLArrayMarshaller ¶
type URLArrayMarshaller struct {
// contains filtered or unexported fields
}
URLArrayMarshaller marshals an array of URLs into a log field.
func NewURLArrayMarshaller ¶
func NewURLArrayMarshaller(urls []*url.URL) *URLArrayMarshaller
NewURLArrayMarshaller returns a new URLArrayMarshaller.
func (*URLArrayMarshaller) MarshalLogArray ¶
func (m *URLArrayMarshaller) MarshalLogArray(e zapcore.ArrayEncoder) error
MarshalLogArray marshals the array.