Perhaps a shared, "safe" logging function makes sense?