Skip to content

Commit

Permalink
Ensure that logger writes to stdout
Browse files Browse the repository at this point in the history
Previously, if an ~/.ecr/log directory existed, the logger would write
to ~/.ecr/log/ecr-login.log instead of stdout. This would result in
commands seeming to hang or exist immediately. This ensures logs are
written correctly to stdout.

Fixes aws#675
  • Loading branch information
SoManyHs committed Nov 29, 2018
1 parent 6385c76 commit 7028ebd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ecs-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/commands/license"
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/commands/log"
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/commands/regcreds"
logger "github.com/awslabs/amazon-ecr-credential-helper/ecr-login/config"
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/utils/logger"
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/version"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
Expand Down
28 changes: 28 additions & 0 deletions ecs-cli/modules/utils/logger/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2015-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file 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 logger

import (
"os"
"github.com/sirupsen/logrus"
)

func SetupLogger() {
logrusConfig()
}

func logrusConfig() {
logrus.SetLevel(logrus.InfoLevel)
logrus.SetOutput(os.Stdout)
}

0 comments on commit 7028ebd

Please sign in to comment.