github.com/scaleway/scaleway-cli@v1.11.1/pkg/utils/quiet.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 // Package utils contains logquiet 6 package utils 7 8 import ( 9 "fmt" 10 "os" 11 ) 12 13 // LogQuietStruct is a struct to store information about quiet state 14 type LogQuietStruct struct { 15 quiet bool 16 } 17 18 var instanceQuiet LogQuietStruct 19 20 // Quiet enable or disable quiet 21 func Quiet(option bool) { 22 instanceQuiet.quiet = option 23 } 24 25 // LogQuiet Displays info if quiet is activated 26 func LogQuiet(str string) { 27 if !instanceQuiet.quiet { 28 fmt.Fprintf(os.Stderr, "%s", str) 29 } 30 }