Merge pull request #4738 from steven-zou/fix_nil_job_logger_issue

Return the logger.Interface instead of the pointer of logger to avoid nil checking issue
This commit is contained in:
Daniel Jiang 2018-04-20 18:53:44 +08:00 committed by GitHub
commit 641f01eb0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"strings"
"github.com/vmware/harbor/src/common/utils/log"
"github.com/vmware/harbor/src/jobservice/logger"
)
//JobLogger is an implementation of logger.Interface.
@ -16,7 +17,7 @@ type JobLogger struct {
//New logger
//nil might be returned
func New(logPath string, level string) *JobLogger {
func New(logPath string, level string) logger.Interface {
f, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return nil