package mypackage import ( "testing" "github.com/juju/loggo" "github.com/juju/loggo/testwriter" ) func TestMyFunction(t *testing.T) { logger := loggo.GetLogger("mypackage.myfunction") writer := testwriter.New(t) logger.SetLogLevel(loggo.TRACE) logger.SetOutput(writer) // Perform test function here if writer.LogString() == "" { t.Error("Log messages were not written.") } }In this example, a test function is created for a package called "mypackage". The function calls and logs messages using the TestWriter component from the go github.com.juju.loggo package. The test function checks that log messages were indeed written using the LogString() method from the TestWriter component.