logdna: github.com/ctrlrsf/logdna Index | Files

package logdna

import "github.com/ctrlrsf/logdna"


Package Files



const DefaultFlushLimit = 5000

DefaultFlushLimit is the number of log lines before we flush to LogDNA

const IngestBaseURL = "https://logs.logdna.com/logs/ingest"

IngestBaseURL is the base URL for the LogDNA ingest API.

type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client is a client to the LogDNA logging service.

func NewClient Uses

func NewClient(cfg Config) *Client

NewClient returns a Client configured to send logs to the LogDNA ingest API.

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the client. It also sends any buffered logs.

func (*Client) Flush Uses

func (c *Client) Flush() error

Flush sends any buffered logs to LogDNA and clears the buffered logs.

func (*Client) Log Uses

func (c *Client) Log(t time.Time, msg string)

Log adds a new log line to Client's payload.

To actually send the logs, Flush() needs to be called.

Flush is called automatically if we reach the client's flush limit.

func (*Client) Size Uses

func (c *Client) Size() int

Size returns the number of lines waiting to be sent.

type Config Uses

type Config struct {
    APIKey     string
    LogFile    string
    Hostname   string
    FlushLimit int

Config is used by NewClient to configure new clients.

Package logdna imports 6 packages (graph). Updated 2019-02-17. Refresh now. Tools for package owners.