package
0.0.0-20250224221724-fc8adcb1fe8e
Repository: https://github.com/mongodb/grip.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
# Functions
AddToMulti is a helper function that takes two Sender instances, the first of which must be a multi sender.
No description provided by the author
ErrorHandlerFromSender wraps an existing Sender for sending error messages.
GetBuildloggerConfig produces a BuildloggerConfig object, reading default values from environment variables, although you can set these options yourself.
GetSplunkConnectionInfo builds a SplunkConnectionInfo structure reading default values from the following environment variables:
GRIP_SPLUNK_SERVER_URL GRIP_SPLUNK_CLIENT_TOKEN GRIP_SPLUNK_CHANNEL.
GetXMPPConnectionInfo builds an XMPPConnectionInfo structure reading default values from the following environment variables:
GRIP_XMPP_HOSTNAME GRIP_XMPP_USERNAME GRIP_XMPP_PASSWORD.
MakeBase constructs a Base structure that allows callers to specify the reset and caller function.
MakeBuildlogger constructs a buildlogger targeting sender using the BuildloggerConfig object for configuration.
MakeCallSiteConsoleLogger constructs an unconfigured call site logger that writes output to standard output.
MakeCallSiteFileLogger constructs an unconfigured call site logger that writes output to the specified hours.
MakeCallSiteFormatter returns a MessageFormater that formats messages with the following format:
[p=<levvel>] [<fileName>:<lineNumber>]: <message>
It can never error.
MakeDefaultFormatter returns a MessageFormatter that will produce a message in the following format:
[p=<level>]: <message>
It can never error.
MakeDefaultSystem constructs a default logger that pushes to systemd on platforms where that's available and standard output otherwise.
MakeErrorLogger returns an unconfigured Sender implementation that writes all logging output to standard error.
MakeFileLogger creates a file-based logger, writing output to the specified file.
MakeInternalLogger constructs an internal sender object, typically for use in testing.
MakeJiraCommentLogger is the same as NewJiraCommentLogger but uses a warning level of Trace.
MakeJiraLogger is the same as NewJiraLogger but uses a warning level of Trace.
MakeJSONConsoleLogger returns an un-configured JSON console logging instance.
MakeJSONFileLogger creates an un-configured JSON logger that writes output to the specified file.
MakeJSONFormatter returns a MessageFormatter, that returns messages as the string form of a JSON document built using the Raw method of the Composer.
MakeLocalSyslogLogger is a constructor for creating the same kind of Sender instance as NewSyslogLogger, except connecting directly to the local syslog service.
MakeNative returns an unconfigured native standard-out logger.
MakePlainErrorLogger returns an unconfigured sender without a prefix, using the plain log formatter.
MakePlainFileLogger writes all output to a file, but does not prepend any log formatting to each message.
MakePlainFormatter returns a MessageFormatter that simply returns the string format of the log message.
MakePlainLogger returns an unconfigured sender without a prefix, using the plain log formatter.
MakeSlackLogger is equivalent to NewSlackLogger, but constructs a Sender reading the slack token from the environment variable "GRIP_SLACK_CLIENT_TOKEN".
MakeSMTPLogger constructs an unconfigured (e.g.
MakeSplunkLogger constructs a new Sender implementation that reads the hostname, username, and password from environment variables:
GRIP_SPLUNK_SERVER_URL GRIP_SPLUNK_CLIENT_TOKEN GRIP_SPLUNK_CLIENT_CHANNEL.
MakeSplunkLoggerWithClient is identical to MakeSplunkLogger but allows you to pass in a http.Client.
MakeStandardLogger creates a standard library logging instance that logs all messages to the underlying sender directly at the specified level.
MakeStreamLogger constructs an unconfigured stream sender that writes un-formatted log messages to the specified io.Writer, or instance that implements a conforming subset.
MakeSysLogger constructs a minimal and unconfigured logger that posts to systemd's journal.
MakeSystemdLogger constructs an unconfigured systemd journald logger.
MakeWriterSender returns an sender interface that also implements io.Writer.
MakeXMPP constructs an XMPP logging backend that reads the hostname, username, and password from environment variables:
- GRIP_XMPP_HOSTNAME - GRIP_XMPP_USERNAME - GRIP_XMPP_PASSWORD
The instance is otherwise unconquered.
MakeXMPPFormatter returns a MessageFormatter that will produce messages in the following format, used primarily by the xmpp logger:
[<name>] (p=<priority>) <message>
It can never error.
NewAnnotatingSender adds the annotations defined in the annotations map to every argument.
NewAsyncGroupSender produces an implementation of the Sender interface that, like the MultiSender, distributes a single message to a group of underlying sender implementations.
NewBase constructs a basic Base structure with no op functions for reset, close, and error handling.
NewBufferedAsyncSender provides a Sender implementation that wraps an existing Sender sending messages in batches.
NewBufferedSender provides a Sender implementation that wraps an existing Sender sending messages in batches, on a specified buffer size or after an interval has passed.
NewBuildlogger constructs a Buildlogger-targeted Sender, with level information set.
NewCallSiteConsoleLogger returns a fully configured Sender implementation that writes log messages to standard output in a format that includes the filename and line number of the call site of the logger.
NewCallSiteFileLogger returns a fully configured Sender implementation that writes log messages to a specified file in a format that includes the filename and line number of the call site of the logger.
NewConfiguredMultiSender returns a multi sender implementation with Sender members, but does not force the senders to have conforming name or level values.
NewErrorLogger constructs a configured Sender that writes all output to standard error.
NewFileLogger creates a Sender implementation that writes log output to a file.
NewGenericLogger constructs a Sender that executes a function.
NewGithubCommentLogger creates a new Sender implementation that adds a comment to a github issue (or pull request) for every log message sent.
NewGithubIssuesLogger builds a sender implementation that creates a new issue in a Github Project for each log message.
NewGithubStatusLogger returns a Sender to send payloads to the Github Status API.
NewInMemorySender creates an in-memory buffered sender with the given capacity.
NewInternalLogger creates and returns a Sender implementation that does not log messages, but converts them to the InternalMessage format and puts them into an internal channel, that allows you to access the massages via the extra "GetMessage" method.
NewJiraCommentLogger constructs a Sender that creates issues to jira, given options defined in a JiraOptions struct.
NewJiraLogger constructs a Sender that creates issues to jira, given options defined in a JiraOptions struct.
NewJSONConsoleLogger builds a Sender instance that prints log messages in a JSON formatted to standard output.
NewJSONFileLogger builds a Sender instance that write JSON formated log messages to a file, with one-line per message.
NewMockSender returns a MockSender with the given name.
NewMultiSender configures a new sender implementation that takes a slice of Sender implementations that dispatches all messages to all implementations.
NewNativeLogger creates a new Sender interface that writes all loggable messages to a standard output logger that uses Go's standard library logging system.
NewPlainErrorLogger returns a configured sender that has no prefix and uses a plain formatter for messages, using only the string format for each message.
NewPlainFileLogger creates a new configured logger that writes log data to a file.
NewPlainLogger returns a configured sender that has no prefix and uses a plain formatter for messages, using only the string format for each message.
NewSESLogger returns a Sender implementation backed by SES.
NewSlackLogger constructs a Sender that posts messages to a slack, given a slack API token.
NewSMTPLogger constructs a Sender implementation that delivers mail for every loggable message.
NewSplunkLogger constructs a new Sender implementation that sends messages to a Splunk event collector using the credentials specified in the SplunkConnectionInfo struct.
NewSplunkLoggerWithClient makes it possible to pass an existing http.Client to the splunk instance, but is otherwise identical to NewSplunkLogger.
NewStreamLogger produces a fully configured Sender that writes un-formatted log messages to an io.Writer (or conforming subset).
NewSyslogLogger creates a new Sender object that writes all loggable messages to a syslog instance on the specified network.
NewSystemdLogger creates a Sender object that writes log messages to the system's systemd journald logging facility.
NewWrappedWriterLogger constructs a fully configured Sender implementation that writes all data to the underlying writer.
NewWriterSender wraps another sender and also provides an io.Writer.
NewXMPP constructs an XMPP logging backend that reads the hostname, username, and password from environment variables:
- GRIP_XMPP_HOSTNAME - GRIP_XMPP_USERNAME - GRIP_XMPP_PASSWORD
Otherwise, the semantics of NewXMPPDefault are the same as NewXMPPLogger.
NewXMPPLogger constructs a new Sender implementation that sends messages to an XMPP user, "target", using the credentials specified in the XMPPConnectionInfo struct.
Oauth1Client is used to generate a http.Client that supports OAuth 1.0, to be used as the HTTP client in the Jira client implementation above.
WrapWriter produces a simple writer that does not modify the log lines passed to the writer.
WrapWriterLogger constructs a new unconfigured sender that directly wraps any writer implementation.
# Variables
ErrorTruncated means that the limited buffer capacity was overwritten.
# Structs
Base provides most of the functionality of the Sender interface, except for the Send method, to facilitate writing novel Sender implementations.
BufferedAsyncSenderOptions configure the buffered asynchronous sender.
BufferedSenderOptions configure the buffered sender.
BuildloggerConfig describes the configuration needed for a Sender instance that posts log messages to a buildlogger service (e.g.
GithubOptions contains information about a github account and repository, used in the GithubIssuesLogger and the GithubCommentLogger Sender implementations.
InMemorySender represents an in-memory buffered sender with a fixed message capacity.
InternalMessage provides a complete representation of all information associated with a logging event.
InternalSender implements a Sender object that makes it possible to access logging messages, in the InternalMessage format without logging to an output method.
No description provided by the author
No description provided by the author
No description provided by the author
JiraOptions include configurations for the JIRA client.
LevelInfo provides a sender-independent structure for storing information about a sender's configured log levels.
MockSender is a simple mock implementation of the Sender interface.
SESOptions configures the SES Logger.
SlackOptions configures the behavior for constructing messages sent to slack.
SMTPOptions configures the behavior of the SMTP logger.
SplunkConnectionInfo stores all information needed to connect to a splunk server to send log messsages.
WriterSender wraps another sender and also provides an io.Writer.
XMPPConnectionInfo stores all information needed to connect to an XMPP (jabber) server to send log messages.
# Interfaces
The Sender interface describes how the Journaler type's method in primary "grip" package's methods interact with a logging output method.
WriteStringer captures the relevant part of the io.Writer interface useful for writing log messages to streams.
# Type aliases
ErrorHandler is a function that you can use define how a sender handles errors sending messages.
MessageFormatter is a function type used by senders to construct the entire string returned as part of the output.