Fixing typos, copyright date and changed type in log.go/Error func

added comment and changed type Error(c,sc)

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2020-02-24 19:11:01 -05:00
parent d1d34d2638
commit c18a5a2582
6 changed files with 12 additions and 10 deletions

View File

@@ -3787,7 +3787,7 @@ func (c *client) isClosed() bool {
// Logging functionality scoped to a client or route.
func (c *client) Error(err error) {
c.srv.Errorc(c, err)
c.srv.Errors(c, err)
}
func (c *client) Errorf(format string, v ...interface{}) {

View File

@@ -1,4 +1,4 @@
// Copyright 2012-2021 The NATS Authors
// Copyright 2020 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -40,7 +40,7 @@ func TestErrCtx(t *testing.T) {
t.Fatalf("original error needs to remain")
}
if !strings.HasSuffix(trace, ctx) {
t.Fatalf("ctx nneds to be added")
t.Fatalf("ctx needs to be added")
}
}
@@ -67,7 +67,7 @@ func TestErrCtxWrapped(t *testing.T) {
t.Fatalf("original error needs to remain")
}
if !strings.HasSuffix(trace, ctx) {
t.Fatalf("ctx nneds to be added")
t.Fatalf("ctx needs to be added")
}
if !strings.Contains(trace, ctxO) {
t.Fatalf("Needs to contain every context")

View File

@@ -1,4 +1,4 @@
// Copyright 2012-2019 The NATS Authors
// Copyright 2012-2020 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -163,13 +163,15 @@ func (s *Server) Errors(scope interface{}, e error) {
}, "%s - %s", scope, UnpackIfErrorCtx(e))
}
func (s *Server) Errorc(ctx interface{}, e error) {
// Error logs an error with a context
func (s *Server) Errorc(ctx string, e error) {
s.executeLogCall(func(logger Logger, format string, v ...interface{}) {
logger.Errorf(format, v...)
}, "%s: %s", ctx, UnpackIfErrorCtx(e))
}
func (s *Server) Errorsc(scope interface{}, ctx interface{}, e error) {
// Error logs an error with a scope and context
func (s *Server) Errorsc(scope interface{}, ctx string, e error) {
s.executeLogCall(func(logger Logger, format string, v ...interface{}) {
logger.Errorf(format, v...)
}, "%s - %s: %s", scope, ctx, UnpackIfErrorCtx(e))

View File

@@ -1,4 +1,4 @@
// Copyright 2012-2019 The NATS Authors
// Copyright 2012-2020 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

View File

@@ -1,4 +1,4 @@
// Copyright 2012-2019 The NATS Authors
// Copyright 2012-2020 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

View File

@@ -643,7 +643,7 @@ func (s *Server) reloadOptions(curOpts, newOpts *Options) error {
if err != nil {
return err
}
// Create a ctx that is used to pass special info that we may need
// Create a context that is used to pass special info that we may need
// while applying the new options.
ctx := reloadContext{oldClusterPerms: curOpts.Cluster.Permissions}
s.setOpts(newOpts)