/usr/share/gocode/src/go.pedge.io/lion/gcloud/pusher.go is in golang-go.pedge-lion-dev 0.0~git20171203.2a81062-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | package gcloudlion
//import (
//"time"
//"go.pedge.io/lion"
//"google.golang.org/api/logging/v1beta3"
//)
//const customServiceName = "compute.googleapis.com"
//var (
//// https://cloud.google.com/logging/docs/api/ref/rest/v1beta3/projects.logs.entries/write#LogSeverity
//severityName = map[lion.Level]string{
//lion.LevelNone: "DEFAULT",
//lion.LevelDebug: "DEBUG",
//lion.LevelInfo: "INFO",
//lion.LevelWarn: "WARNING",
//lion.LevelError: "ERROR",
//lion.LevelFatal: "ERROR",
//lion.LevelPanic: "ALERT",
//}
//)
//type pusher struct {
//service *logging.ProjectsLogsEntriesService
//projectID string
//logName string
//}
//func newPusher(
//service *logging.ProjectsLogsEntriesService,
//projectID string,
//logName string,
//) *pusher {
//return &pusher{
//service,
//projectID,
//logName,
//}
//}
//func (p *pusher) Push(entry *lion.Entry) error {
//id := entry.ID
//if id == "" {
//id = lion.DefaultIDAllocator.Allocate()
//}
//_, err := p.service.Write(
//p.projectID,
//p.logName,
//&logging.WriteLogEntriesRequest{
//Entries: []*logging.LogEntry{
//{
//InsertId: id,
//StructPayload: entry,
//Metadata: &logging.LogEntryMetadata{
//ServiceName: customServiceName,
//Severity: severityName[entry.Level],
//Timestamp: entry.Time.Format(time.RFC3339),
//},
//},
//},
//},
//).Do()
//return err
//}
//func (p *pusher) Flush() error {
//return nil
//}
|