github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/worker/syslogger/syslogger.go (about) 1 // Copyright 2022 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package syslogger 5 6 import ( 7 "io" 8 ) 9 10 // NewDiscard creates a new WriteCloser that discards all writes and the close 11 // is a noop. 12 func NewDiscard(priority Priority, tag string) (io.WriteCloser, error) { 13 return nopCloser{ 14 Writer: io.Discard, 15 }, nil 16 } 17 18 // nopCloser is a closer that discards the close request. We can't use the 19 // io.NopCloser as that expects a io.Reader. 20 type nopCloser struct { 21 io.Writer 22 } 23 24 func (nopCloser) Close() error { 25 return nil 26 }