logger

package module
v0.0.0-...-b9b2fa2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2017 License: Apache-2.0 Imports: 7 Imported by: 1

README

README

Support logging client library for the Go implementation of EdgeX microservices. This project contains a logging client used to log messages. Logging a message will send the log to the logging microservice, print the log to stdout and (optionally) write the log to a log file.

What is this repository for?
  • Logging client for logging messages
Installation

This project uses glide for dependency management - https://glide.sh/ After installing glide, run the following commands to install the logging client:

go get github.com/edgexfoundry/support-logging-client-go
cd $GOPATH/src/github.com/edgexfoundry/support-logging-client-go
glide install
go install
How To Use

To make logging calls, you need to have an instance of the LoggingClient struct. Do not create manually. Instead, call:

func NewClient(owningServiceName string, remoteUrl string) LoggingClient{...}
  • owningServiceName - Name of your microservice (used in logs)
  • remoteUrl - Full path to the logging service api

You can optionally define a logging file for logs to be written to. To do this, set the LogFilePath property on the LoggingClient instance. The default path is an empty string which signifies that no log file will be created.

To log messages, call the respective commands (Info, Error, Debug, Warn)

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @microservice: support-logging-client-go library
  • @author: Ryan Comer, Dell
  • @version: 0.5.0 ******************************************************************************

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggingClient

type LoggingClient struct {
	RemoteUrl   string
	LogFilePath string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(owningServiceName string, remoteUrl string) LoggingClient

Create a new logging client for the owning service

func (LoggingClient) Debug

func (lc LoggingClient) Debug(msg string, labels ...string) error

Log a DEBUG level message

func (LoggingClient) Error

func (lc LoggingClient) Error(msg string, labels ...string) error

Log an ERROR level message

func (LoggingClient) Info

func (lc LoggingClient) Info(msg string, labels ...string) error

Log an INFO level message

func (LoggingClient) Trace

func (lc LoggingClient) Trace(msg string, labels ...string)

Log a TRACE level message

func (LoggingClient) Warn

func (lc LoggingClient) Warn(msg string, labels ...string) error

Log a WARN level message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL