aelog

package module
v0.0.0-...-4cb750a Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 9 Imported by: 0

README

AppEngine Logger Wrapper

Packge github.com/1919yuan/aelog provides a wrapping utility for logging to stdout when testing locally and logging to StackDriver when running on AppEngine.

Example Usage

import (
  "github.com/1919yuan/aelog"
)

...

aelog.Debug("Testing: Debug")
aelog.Info("Testing: Info")
aelog.Warning("Testing: Warning")
aelog.Error("Testing: Error")
aelog.Fatal("Testing: Fatal")

The logging will be done using the log package when the program is running locally and will be done using cloud.google.com/go/logging.Logger when the program is running in AppEngine environment.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...interface{})

func Error

func Error(format string, args ...interface{})

func Fatal

func Fatal(format string, args ...interface{})

func Info

func Info(format string, args ...interface{})

func UseSyslog

func UseSyslog() bool

func Warning

func Warning(format string, args ...interface{})

Types

type Logger

type Logger interface {
	Fatal(format string, args ...interface{})
	Error(format string, args ...interface{})
	Warning(format string, args ...interface{})
	Info(format string, args ...interface{})
	Debug(format string, args ...interface{})
	Close()
}
var (
	Log Logger
)

func NewStackDriverLogger

func NewStackDriverLogger(
	ctx context.Context, client *logging.Client) Logger

func NewSysLogger

func NewSysLogger() Logger

type StackDriverLogger

type StackDriverLogger struct {
	// contains filtered or unexported fields
}

func (*StackDriverLogger) Close

func (l *StackDriverLogger) Close()

func (*StackDriverLogger) Debug

func (l *StackDriverLogger) Debug(format string, args ...interface{})

func (*StackDriverLogger) Error

func (l *StackDriverLogger) Error(format string, args ...interface{})

func (*StackDriverLogger) Fatal

func (l *StackDriverLogger) Fatal(format string, args ...interface{})

func (*StackDriverLogger) Info

func (l *StackDriverLogger) Info(format string, args ...interface{})

func (*StackDriverLogger) Warning

func (l *StackDriverLogger) Warning(format string, args ...interface{})

type SysLogger

type SysLogger struct {
}

func (*SysLogger) Close

func (l *SysLogger) Close()

func (*SysLogger) Debug

func (l *SysLogger) Debug(format string, args ...interface{})

func (*SysLogger) Error

func (l *SysLogger) Error(format string, args ...interface{})

func (*SysLogger) Fatal

func (l *SysLogger) Fatal(format string, args ...interface{})

func (*SysLogger) Info

func (l *SysLogger) Info(format string, args ...interface{})

func (*SysLogger) Warning

func (l *SysLogger) Warning(format string, args ...interface{})

Jump to

Keyboard shortcuts

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