@@ -57,20 +57,32 @@ type SyncConfig struct {
5757// Logf prints the given information to the synclog with context data
5858func (s * SyncConfig ) Logf (format string , args ... interface {}) {
5959 if s .silent == false {
60- syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).WithKey ("excluded" , s .ExcludePaths ).Infof (format , args ... )
60+ if s .Pod != nil {
61+ syncLog .WithKey ("pod" , s .Pod .Name ).WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Infof (format , args ... )
62+ } else {
63+ syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Infof (format , args ... )
64+ }
6165 }
6266}
6367
6468// Logln prints the given information to the synclog with context data
6569func (s * SyncConfig ) Logln (line interface {}) {
6670 if s .silent == false {
67- syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).WithKey ("excluded" , s .ExcludePaths ).Info (line )
71+ if s .Pod != nil {
72+ syncLog .WithKey ("pod" , s .Pod .Name ).WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Info (line )
73+ } else {
74+ syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Info (line )
75+ }
6876 }
6977}
7078
7179// Error handles a sync error with context
7280func (s * SyncConfig ) Error (err error ) {
73- syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).WithKey ("excluded" , s .ExcludePaths ).Errorf ("Error: %v, Stack: %v" , err , errors .ErrorStack (err ))
81+ if s .Pod != nil {
82+ syncLog .WithKey ("pod" , s .Pod .Name ).WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Errorf ("Error: %v, Stack: %v" , err , errors .ErrorStack (err ))
83+ } else {
84+ syncLog .WithKey ("local" , s .WatchPath ).WithKey ("container" , s .DestPath ).Errorf ("Error: %v, Stack: %v" , err , errors .ErrorStack (err ))
85+ }
7486
7587 if s .errorChan != nil {
7688 s .errorChan <- err
@@ -175,7 +187,7 @@ func (s *SyncConfig) initIgnoreParsers() error {
175187}
176188
177189func (s * SyncConfig ) mainLoop () {
178- s .Logf ("[Sync] Start syncing\n " )
190+ s .Logf ("[Sync] Start syncing" )
179191
180192 err := s .initialSync ()
181193 if err != nil {
0 commit comments