applog

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 15 Imported by: 0

README

applog

applog to cloud using http.

包名:

"github.com/hpgood/applog"

配置文件data/config/app.ini 加入:

[log]
project=applog_demo
version=0.0.1
time=5000
appid=100
token=from_k8s
url=http://apps-applog.default/logcat/server

说明:

project 工程名字
version 版本号
time 日志提交频率,默认 5000 ms
appid 自定义整数appid 建议用3位固定数字,减少重复。
token from_k8s 默认即可
url  http://apps-applog.default/logcat/server  默认即可

代码例子:

https://github.com/hpgood/applog/blob/main/main/main.go

import (
	"log"
	"time"

	"github.com/hpgood/applog"
)

func main() {
  log.Println("start test log")
  var userID int64=1
  applog.Fine("tag1","hello message",userID)
  applog.Info("tag1","hello message",userID)
  time.Sleep(time.Second*5)
  applog.Warn("tag2","my warn message",userID)
  applog.Error("tag2","my error message",userID)
  time.Sleep(time.Second*5)
  applog.Info("tag3","finish!",userID)
}

Documentation

Index

Constants

View Source
const LevelError = 3

LevelError LevelError

View Source
const LevelFine = 0

LevelFine LevelFine

View Source
const LevelInfo = 1

LevelInfo LevelInfo

View Source
const LevelWarn = 2

LevelWarn LevelWarn

Variables

This section is empty.

Functions

func Error

func Error(tag string, message string, uid int64)

Error Error

func Fine

func Fine(tag string, message string, uid int64)

Fine Fine

func Info

func Info(tag string, message string, uid int64)

Info Info

func LevelName

func LevelName(level int) string

LevelName LevelName

func Warn

func Warn(tag string, message string, uid int64)

Warn Warn

Types

type AppConfig

type AppConfig struct {
	Code   int  `json:"code"`
	Enable bool `json:"enable"`
	Level  int  `json:"level"`
}

AppConfig AppConfig

type ConfigData

type ConfigData struct {
	Project string
	Version string
	Time    int
	Appid   int
	Token   string
	URL     string
	Enable  bool
	Level   int
}

ConfigData ConfigData

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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