Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added copyrights to missing files and changed logger context funcs #17

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- changed setting/getting logger in context to use xlog package [#17](https://github.com/xmidt-org/argus/pull/17)

## [v0.3.4]
- handle error case of identifier being too large [#14](https://github.com/xmidt-org/argus/pull/14)
Expand Down
31 changes: 25 additions & 6 deletions auth.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package main

import (
"bytes"
"context"
"emperror.dev/emperror"
"encoding/base64"
"net/http"
"regexp"
"strings"

"emperror.dev/emperror"
"github.com/go-kit/kit/log"
"github.com/justinas/alice"
"github.com/spf13/viper"
"github.com/xmidt-org/bascule"
"github.com/xmidt-org/bascule/acquire"
"github.com/xmidt-org/bascule/basculehttp"
"github.com/xmidt-org/bascule/key"
"github.com/xmidt-org/themis/xlog"
"github.com/xmidt-org/themis/xmetrics"
"github.com/xmidt-org/webpa-common/basculechecks"
"github.com/xmidt-org/webpa-common/basculemetrics"
"github.com/xmidt-org/webpa-common/logging"
"go.uber.org/fx"
"net/http"
"regexp"
"strings"
)

func SetLogger(logger log.Logger) func(delegate http.Handler) http.Handler {
Expand All @@ -31,15 +50,15 @@ func SetLogger(logger log.Logger) func(delegate http.Handler) http.Handler {
logHeader.Del("Authorization")
logHeader.Set("Authorization-Type", strings.Split(str, " ")[0])
}
ctx := r.WithContext(logging.WithLogger(r.Context(),
ctx := r.WithContext(xlog.With(r.Context(),
log.With(logger, "requestHeaders", logHeader, "requestURL", r.URL.EscapedPath(), "method", r.Method)))
delegate.ServeHTTP(w, ctx)
})
}
}

func GetLogger(ctx context.Context) bascule.Logger {
logger := log.With(logging.GetLogger(ctx), "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
logger := log.With(xlog.GetDefault(ctx, nil), "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
return logger
}

Expand Down
17 changes: 17 additions & 0 deletions chrysom/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Package chrysom provides a client in order to interact with argus.
package chrysom
29 changes: 29 additions & 0 deletions go.sum

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions model/model.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package model

// Key defines the field mapping to retrieve an item from storage.
Expand Down
17 changes: 17 additions & 0 deletions store/db/provide.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package db

import (
Expand Down
17 changes: 17 additions & 0 deletions store/dynamodb/db.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package dynamodb

import (
Expand Down
20 changes: 19 additions & 1 deletion store/dynamodb/executer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
/**
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package dynamodb

import (
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
Expand All @@ -10,7 +29,6 @@ import (
"github.com/xmidt-org/argus/model"
"github.com/xmidt-org/argus/store"
"github.com/xmidt-org/webpa-common/logging"
"time"
)

type dynamoDBExecutor struct {
Expand Down