diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-29 08:31:26 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-29 08:31:26 +0300 |
| commit | ffa39a17f48ee9847cc85819d8134b5eb9482b77 (patch) | |
| tree | 22ac90a46160ccc2927ba0a5b4406906072a56bb /internal/mapr | |
| parent | f9c51eb8bc3295c52dfde821aaed324f9447a993 (diff) | |
explicitly use dlog.Server for server packages and dlog.Clent for client packages for logging
Diffstat (limited to 'internal/mapr')
| -rw-r--r-- | internal/mapr/client/aggregate.go | 2 | ||||
| -rw-r--r-- | internal/mapr/server/aggregate.go | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/internal/mapr/client/aggregate.go b/internal/mapr/client/aggregate.go index 02a6a5a..1704d43 100644 --- a/internal/mapr/client/aggregate.go +++ b/internal/mapr/client/aggregate.go @@ -54,7 +54,7 @@ func (a *Aggregate) Aggregate(message string) error { for _, sc := range a.query.Select { if val, ok := fields[sc.FieldStorage]; ok { if err := set.Aggregate(sc.FieldStorage, sc.Operation, val, true); err != nil { - dlog.Common.Error(err) + dlog.Client.Error(err) continue } addedSamples = true diff --git a/internal/mapr/server/aggregate.go b/internal/mapr/server/aggregate.go index 4162828..cb0da2b 100644 --- a/internal/mapr/server/aggregate.go +++ b/internal/mapr/server/aggregate.go @@ -39,7 +39,7 @@ func NewAggregate(queryStr string) (*Aggregate, error) { fqdn, err := config.Hostname() if err != nil { - dlog.Common.Error(err) + dlog.Server.Error(err) } s := strings.Split(fqdn, ".") @@ -54,12 +54,12 @@ func NewAggregate(queryStr string) (*Aggregate, error) { parserName = query.LogFormat } - dlog.Common.Info("Creating log format parser", parserName) + dlog.Server.Info("Creating log format parser", parserName) logParser, err := logformat.NewParser(parserName, query) if err != nil { - dlog.Common.Error("Could not create log format parser. Falling back to 'generic'", err) + dlog.Server.Error("Could not create log format parser. Falling back to 'generic'", err) if logParser, err = logformat.NewParser("generic", query); err != nil { - dlog.Common.FatalPanic("Could not create log format parser", err) + dlog.Server.FatalPanic("Could not create log format parser", err) } } @@ -115,7 +115,7 @@ func (a *Aggregate) aggregateTimer(ctx context.Context) { func (a *Aggregate) nextLine() (line line.Line, ok bool, noMoreChannels bool) { - dlog.Common.Trace("nextLine", "entry", line, ok, noMoreChannels) + dlog.Server.Trace("nextLine", "entry", line, ok, noMoreChannels) select { case line, ok = <-a.linesCh: if !ok { @@ -137,7 +137,7 @@ func (a *Aggregate) nextLine() (line line.Line, ok bool, noMoreChannels bool) { // No new lines channel found. } } - dlog.Common.Trace("nextLine", "exit", line, ok, noMoreChannels) + dlog.Server.Trace("nextLine", "exit", line, ok, noMoreChannels) return } @@ -180,7 +180,7 @@ func (a *Aggregate) fieldsFromLines(ctx context.Context) <-chan map[string]strin if err != nil { // Should fields be ignored anyway? if err != logformat.ErrIgnoreFields { - dlog.Common.Error(fields, err) + dlog.Server.Error(fields, err) } continue } @@ -210,7 +210,7 @@ func (a *Aggregate) setAdditionalFields(ctx context.Context, return } if err := a.query.SetClause(fields); err != nil { - dlog.Common.Error(err) + dlog.Server.Error(err) } select { @@ -227,7 +227,7 @@ func (a *Aggregate) aggregateAndSerialize(ctx context.Context, group := mapr.NewGroupSet() serialize := func() { - dlog.Common.Info("Serializing mapreduce result") + dlog.Server.Info("Serializing mapreduce result") group.Serialize(ctx, maprMessages) group = mapr.NewGroupSet() } @@ -264,7 +264,7 @@ func (a *Aggregate) aggregate(group *mapr.GroupSet, fields map[string]string) { for _, sc := range a.query.Select { if val, ok := fields[sc.Field]; ok { if err := set.Aggregate(sc.FieldStorage, sc.Operation, val, false); err != nil { - dlog.Common.Error(err) + dlog.Server.Error(err) continue } addedSample = true @@ -275,7 +275,7 @@ func (a *Aggregate) aggregate(group *mapr.GroupSet, fields map[string]string) { set.Samples++ return } - dlog.Common.Trace("Aggregated data locally without adding new samples") + dlog.Server.Trace("Aggregated data locally without adding new samples") } // Serialize all the aggregated data. @@ -283,7 +283,7 @@ func (a *Aggregate) Serialize(ctx context.Context) { select { case a.serialize <- struct{}{}: case <-time.After(time.Minute): - dlog.Common.Warn("Starting to serialize mapredice data takes over a minute") + dlog.Server.Warn("Starting to serialize mapredice data takes over a minute") case <-ctx.Done(): } } |
