-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from depot/debug-logging
Add debug logging
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package debuglog | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
depotprogress "github.com/depot/cli/pkg/progress" | ||
) | ||
|
||
var Debug bool | ||
|
||
func Log(format string, args ...interface{}) { | ||
if Debug { | ||
log.Printf(format, args...) | ||
} | ||
} | ||
|
||
func LogProgress(printer *depotprogress.Progress, message string, err error) { | ||
if Debug { | ||
printer.Log(message, err) | ||
} | ||
} | ||
|
||
func init() { | ||
Debug = os.Getenv("DEPOT_DEBUG") != "" | ||
} |