aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-03-21 16:36:33 -0700
committerColin Cross <ccross@android.com>2019-03-21 21:17:04 -0700
commit1aeb049a5463c8c87beb8aa034c3899a2f39a893 (patch)
tree0baf13ca3fed5c454988cbf0b52bd4d94f6b955d /ui
parentb98d3bcf4efd0fa32b4dcd0ef5fc395536760f4d (diff)
downloadbuild_soong-1aeb049a5463c8c87beb8aa034c3899a2f39a893.tar.gz
build_soong-1aeb049a5463c8c87beb8aa034c3899a2f39a893.tar.bz2
build_soong-1aeb049a5463c8c87beb8aa034c3899a2f39a893.zip
Panic if logging is attempted after Close
Attempt to catch places where logs are truncated by panicing if logging is attempted after Close. Test: m nothing Change-Id: If670f20d08832ed65b63af5589b548e9815f2f0d
Diffstat (limited to 'ui')
-rw-r--r--ui/logger/logger.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/logger/logger.go b/ui/logger/logger.go
index 58890e96..9b26ae80 100644
--- a/ui/logger/logger.go
+++ b/ui/logger/logger.go
@@ -180,12 +180,16 @@ func (s *stdLogger) SetOutput(path string) *stdLogger {
return s
}
+type panicWriter struct{}
+
+func (panicWriter) Write([]byte) (int, error) { panic("write to panicWriter") }
+
// Close disables logging to the file and closes the file handle.
func (s *stdLogger) Close() {
s.mutex.Lock()
defer s.mutex.Unlock()
if s.file != nil {
- s.fileLogger.SetOutput(ioutil.Discard)
+ s.fileLogger.SetOutput(panicWriter{})
s.file.Close()
s.file = nil
}