mirror of
https://github.com/astaxie/beego.git
synced 2025-06-14 01:30:40 +00:00
More minor grammar fixes
This commit is contained in:
@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// CacheSize set the flush size
|
||||
// CacheSize sets the flush size
|
||||
CacheSize int = 64
|
||||
// Delimiter define the topic delimiter
|
||||
// Delimiter defines the topic delimiter
|
||||
Delimiter string = "##"
|
||||
)
|
||||
|
||||
@ -31,7 +31,7 @@ type Config struct {
|
||||
}
|
||||
|
||||
// aliLSWriter implements LoggerInterface.
|
||||
// it writes messages in keep-live tcp connection.
|
||||
// Writes messages in keep-live tcp connection.
|
||||
type aliLSWriter struct {
|
||||
store *LogStore
|
||||
group []*LogGroup
|
||||
@ -41,14 +41,14 @@ type aliLSWriter struct {
|
||||
Config
|
||||
}
|
||||
|
||||
// NewAliLS create a new Logger
|
||||
// NewAliLS creates a new Logger
|
||||
func NewAliLS() logs.Logger {
|
||||
alils := new(aliLSWriter)
|
||||
alils.Level = logs.LevelTrace
|
||||
return alils
|
||||
}
|
||||
|
||||
// Init parse config and init struct
|
||||
// Init parses config and initializes struct
|
||||
func (c *aliLSWriter) Init(jsonConfig string) (err error) {
|
||||
|
||||
json.Unmarshal([]byte(jsonConfig), c)
|
||||
@ -101,8 +101,8 @@ func (c *aliLSWriter) Init(jsonConfig string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteMsg write message in connection.
|
||||
// if connection is down, try to re-connect.
|
||||
// WriteMsg writes a message in connection.
|
||||
// If connection is down, try to re-connect.
|
||||
func (c *aliLSWriter) WriteMsg(when time.Time, msg string, level int) (err error) {
|
||||
|
||||
if level > c.Level {
|
||||
|
@ -4,10 +4,10 @@ const (
|
||||
version = "0.5.0" // SDK version
|
||||
signatureMethod = "hmac-sha1" // Signature method
|
||||
|
||||
// OffsetNewest stands for the log head offset, i.e. the offset that will be
|
||||
// OffsetNewest is the log head offset, i.e. the offset that will be
|
||||
// assigned to the next message that will be produced to the shard.
|
||||
OffsetNewest = "end"
|
||||
// OffsetOldest stands for the oldest offset available on the logstore for a
|
||||
// OffsetOldest is the the oldest offset available on the logstore for a
|
||||
// shard.
|
||||
OffsetOldest = "begin"
|
||||
)
|
||||
|
@ -31,13 +31,13 @@ type Log struct {
|
||||
// Reset the Log
|
||||
func (m *Log) Reset() { *m = Log{} }
|
||||
|
||||
// String return the Compact Log
|
||||
// String returns the Compact Log
|
||||
func (m *Log) String() string { return proto.CompactTextString(m) }
|
||||
|
||||
// ProtoMessage not implemented
|
||||
func (*Log) ProtoMessage() {}
|
||||
|
||||
// GetTime return the Log's Time
|
||||
// GetTime returns the Log's Time
|
||||
func (m *Log) GetTime() uint32 {
|
||||
if m != nil && m.Time != nil {
|
||||
return *m.Time
|
||||
@ -45,7 +45,7 @@ func (m *Log) GetTime() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetContents return the Log's Contents
|
||||
// GetContents returns the Log's Contents
|
||||
func (m *Log) GetContents() []*LogContent {
|
||||
if m != nil {
|
||||
return m.Contents
|
||||
@ -53,7 +53,7 @@ func (m *Log) GetContents() []*LogContent {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LogContent define the Log content struct
|
||||
// LogContent defines the Log content struct
|
||||
type LogContent struct {
|
||||
Key *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"`
|
||||
Value *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"`
|
||||
@ -63,13 +63,13 @@ type LogContent struct {
|
||||
// Reset LogContent
|
||||
func (m *LogContent) Reset() { *m = LogContent{} }
|
||||
|
||||
// String return the compact text
|
||||
// String returns the compact text
|
||||
func (m *LogContent) String() string { return proto.CompactTextString(m) }
|
||||
|
||||
// ProtoMessage not implemented
|
||||
func (*LogContent) ProtoMessage() {}
|
||||
|
||||
// GetKey return the Key
|
||||
// GetKey returns the key
|
||||
func (m *LogContent) GetKey() string {
|
||||
if m != nil && m.Key != nil {
|
||||
return *m.Key
|
||||
@ -77,7 +77,7 @@ func (m *LogContent) GetKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetValue return the Value
|
||||
// GetValue returns the value
|
||||
func (m *LogContent) GetValue() string {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
@ -85,7 +85,7 @@ func (m *LogContent) GetValue() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// LogGroup define the logs struct
|
||||
// LogGroup defines the logs struct
|
||||
type LogGroup struct {
|
||||
Logs []*Log `protobuf:"bytes,1,rep,name=Logs" json:"Logs,omitempty"`
|
||||
Reserved *string `protobuf:"bytes,2,opt,name=Reserved" json:"Reserved,omitempty"`
|
||||
@ -97,13 +97,13 @@ type LogGroup struct {
|
||||
// Reset LogGroup
|
||||
func (m *LogGroup) Reset() { *m = LogGroup{} }
|
||||
|
||||
// String return the compact text
|
||||
// String returns the compact text
|
||||
func (m *LogGroup) String() string { return proto.CompactTextString(m) }
|
||||
|
||||
// ProtoMessage not implemented
|
||||
func (*LogGroup) ProtoMessage() {}
|
||||
|
||||
// GetLogs return the loggroup logs
|
||||
// GetLogs returns the loggroup logs
|
||||
func (m *LogGroup) GetLogs() []*Log {
|
||||
if m != nil {
|
||||
return m.Logs
|
||||
@ -111,7 +111,8 @@ func (m *LogGroup) GetLogs() []*Log {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetReserved return Reserved
|
||||
// GetReserved returns Reserved. An empty string is returned
|
||||
// if an error occurs
|
||||
func (m *LogGroup) GetReserved() string {
|
||||
if m != nil && m.Reserved != nil {
|
||||
return *m.Reserved
|
||||
@ -119,7 +120,8 @@ func (m *LogGroup) GetReserved() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetTopic return Topic
|
||||
// GetTopic returns Topic. An empty string is returned
|
||||
// if an error occurs
|
||||
func (m *LogGroup) GetTopic() string {
|
||||
if m != nil && m.Topic != nil {
|
||||
return *m.Topic
|
||||
@ -127,7 +129,8 @@ func (m *LogGroup) GetTopic() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetSource return Source
|
||||
// GetSource returns source. An empty string is returned
|
||||
// if an error occurs
|
||||
func (m *LogGroup) GetSource() string {
|
||||
if m != nil && m.Source != nil {
|
||||
return *m.Source
|
||||
@ -135,7 +138,7 @@ func (m *LogGroup) GetSource() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// LogGroupList define the LogGroups
|
||||
// LogGroupList defines the LogGroups
|
||||
type LogGroupList struct {
|
||||
LogGroups []*LogGroup `protobuf:"bytes,1,rep,name=logGroups" json:"logGroups,omitempty"`
|
||||
XXXUnrecognized []byte `json:"-"`
|
||||
@ -144,13 +147,13 @@ type LogGroupList struct {
|
||||
// Reset LogGroupList
|
||||
func (m *LogGroupList) Reset() { *m = LogGroupList{} }
|
||||
|
||||
// String return compact text
|
||||
// String returns compact text
|
||||
func (m *LogGroupList) String() string { return proto.CompactTextString(m) }
|
||||
|
||||
// ProtoMessage not implemented
|
||||
func (*LogGroupList) ProtoMessage() {}
|
||||
|
||||
// GetLogGroups return the LogGroups
|
||||
// GetLogGroups returns the LogGroups
|
||||
func (m *LogGroupList) GetLogGroups() []*LogGroup {
|
||||
if m != nil {
|
||||
return m.LogGroups
|
||||
@ -158,7 +161,7 @@ func (m *LogGroupList) GetLogGroups() []*LogGroup {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Marshal the logs to byte slice
|
||||
// Marshal marshals the logs to byte slice
|
||||
func (m *Log) Marshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
@ -353,7 +356,7 @@ func encodeVarintLog(data []byte, offset int, v uint64) int {
|
||||
return offset + 1
|
||||
}
|
||||
|
||||
// Size return the log's size
|
||||
// Size returns the log's size
|
||||
func (m *Log) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -372,7 +375,7 @@ func (m *Log) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
// Size return LogContent size based on Key and Value
|
||||
// Size returns LogContent size based on Key and Value
|
||||
func (m *LogContent) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -390,7 +393,7 @@ func (m *LogContent) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
// Size return LogGroup size based on Logs
|
||||
// Size returns LogGroup size based on Logs
|
||||
func (m *LogGroup) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -418,7 +421,7 @@ func (m *LogGroup) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
// Size return LogGroupList size
|
||||
// Size returns LogGroupList size
|
||||
func (m *LogGroupList) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -448,7 +451,7 @@ func sozLog(x uint64) (n int) {
|
||||
return sovLog((x << 1) ^ (x >> 63))
|
||||
}
|
||||
|
||||
// Unmarshal data to log
|
||||
// Unmarshal unmarshals data to log
|
||||
func (m *Log) Unmarshal(data []byte) error {
|
||||
var hasFields [1]uint64
|
||||
l := len(data)
|
||||
@ -557,7 +560,7 @@ func (m *Log) Unmarshal(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unmarshal data to LogContent
|
||||
// Unmarshal unmarshals data to LogContent
|
||||
func (m *LogContent) Unmarshal(data []byte) error {
|
||||
var hasFields [1]uint64
|
||||
l := len(data)
|
||||
@ -679,7 +682,7 @@ func (m *LogContent) Unmarshal(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unmarshal data to LogGroup
|
||||
// Unmarshal unmarshals data to LogGroup
|
||||
func (m *LogGroup) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
@ -853,7 +856,7 @@ func (m *LogGroup) Unmarshal(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unmarshal data to LogGroupList
|
||||
// Unmarshal unmarshals data to LogGroupList
|
||||
func (m *LogGroupList) Unmarshal(data []byte) error {
|
||||
l := len(data)
|
||||
iNdEx := 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
package alils
|
||||
|
||||
// InputDetail define log detail
|
||||
// InputDetail defines log detail
|
||||
type InputDetail struct {
|
||||
LogType string `json:"logType"`
|
||||
LogPath string `json:"logPath"`
|
||||
@ -15,13 +15,13 @@ type InputDetail struct {
|
||||
TopicFormat string `json:"topicFormat"`
|
||||
}
|
||||
|
||||
// OutputDetail define the output detail
|
||||
// OutputDetail defines the output detail
|
||||
type OutputDetail struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
LogStoreName string `json:"logstoreName"`
|
||||
}
|
||||
|
||||
// LogConfig define Log Config
|
||||
// LogConfig defines Log Config
|
||||
type LogConfig struct {
|
||||
Name string `json:"configName"`
|
||||
InputType string `json:"inputType"`
|
||||
|
@ -20,7 +20,7 @@ type errorMessage struct {
|
||||
Message string `json:"errorMessage"`
|
||||
}
|
||||
|
||||
// LogProject Define the Ali Project detail
|
||||
// LogProject defines the Ali Project detail
|
||||
type LogProject struct {
|
||||
Name string // Project name
|
||||
Endpoint string // IP or hostname of SLS endpoint
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// LogStore Store the logs
|
||||
// LogStore stores the logs
|
||||
type LogStore struct {
|
||||
Name string `json:"logstoreName"`
|
||||
TTL int
|
||||
@ -24,7 +24,7 @@ type LogStore struct {
|
||||
project *LogProject
|
||||
}
|
||||
|
||||
// Shard define the Log Shard
|
||||
// Shard defines the Log Shard
|
||||
type Shard struct {
|
||||
ShardID int `json:"shardID"`
|
||||
}
|
||||
@ -71,7 +71,7 @@ func (s *LogStore) ListShards() (shardIDs []int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// PutLogs put logs into logstore.
|
||||
// PutLogs puts logs into logstore.
|
||||
// The callers should transform user logs into LogGroup.
|
||||
func (s *LogStore) PutLogs(lg *LogGroup) (err error) {
|
||||
body, err := proto.Marshal(lg)
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
"net/http/httputil"
|
||||
)
|
||||
|
||||
// MachineGroupAttribute define the Attribute
|
||||
// MachineGroupAttribute defines the Attribute
|
||||
type MachineGroupAttribute struct {
|
||||
ExternalName string `json:"externalName"`
|
||||
TopicName string `json:"groupTopic"`
|
||||
}
|
||||
|
||||
// MachineGroup define the machine Group
|
||||
// MachineGroup defines the machine Group
|
||||
type MachineGroup struct {
|
||||
Name string `json:"groupName"`
|
||||
Type string `json:"groupType"`
|
||||
@ -29,20 +29,20 @@ type MachineGroup struct {
|
||||
project *LogProject
|
||||
}
|
||||
|
||||
// Machine define the Machine
|
||||
// Machine defines the Machine
|
||||
type Machine struct {
|
||||
IP string
|
||||
UniqueID string `json:"machine-uniqueid"`
|
||||
UserdefinedID string `json:"userdefined-id"`
|
||||
}
|
||||
|
||||
// MachineList define the Machine List
|
||||
// MachineList defines the Machine List
|
||||
type MachineList struct {
|
||||
Total int
|
||||
Machines []*Machine
|
||||
}
|
||||
|
||||
// ListMachines returns machine list of this machine group.
|
||||
// ListMachines returns the machine list of this machine group.
|
||||
func (m *MachineGroup) ListMachines() (ms []*Machine, total int, err error) {
|
||||
h := map[string]string{
|
||||
"x-sls-bodyrawsize": "0",
|
||||
|
Reference in New Issue
Block a user