mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Return the logger.Interface instead of the pointer of logger to avoid nil checking issue
This commit is contained in:
parent
4da4dd6694
commit
a17436962f
@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/vmware/harbor/src/common/utils/log"
|
"github.com/vmware/harbor/src/common/utils/log"
|
||||||
|
"github.com/vmware/harbor/src/jobservice/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
//JobLogger is an implementation of logger.Interface.
|
//JobLogger is an implementation of logger.Interface.
|
||||||
@ -16,7 +17,7 @@ type JobLogger struct {
|
|||||||
|
|
||||||
//New logger
|
//New logger
|
||||||
//nil might be returned
|
//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)
|
f, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user