This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
option to enable soap client debugging (#2442)
Signed-off-by: Dani Louca <[email protected]> Signed-off-by: Dani Louca <[email protected]>
- Loading branch information
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package service | ||
|
||
import ( | ||
"io" | ||
"regexp" | ||
|
||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type LogWriterCloser struct { | ||
log logrus.FieldLogger | ||
} | ||
|
||
func NewLogWriterCloser(log logrus.FieldLogger) *LogWriterCloser { | ||
return &LogWriterCloser{log: log} | ||
} | ||
|
||
func (lwc *LogWriterCloser) Write(p []byte) (n int, err error) { | ||
lwc.log.Info(string(Scrub(p))) | ||
return len(p), nil | ||
} | ||
|
||
func (lwc *LogWriterCloser) Close() error { | ||
return nil | ||
} | ||
|
||
type LogProvider struct { | ||
log logrus.FieldLogger | ||
} | ||
|
||
func (s *LogProvider) NewFile(p string) io.WriteCloser { | ||
return NewLogWriterCloser(s.log) | ||
} | ||
|
||
func (s *LogProvider) Flush() { | ||
} | ||
|
||
var scrubPassword = regexp.MustCompile(`<password>(.*)</password>`) | ||
|
||
func Scrub(in []byte) []byte { | ||
return scrubPassword.ReplaceAll(in, []byte(`<password>********</password>`)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters