Skip to content

Commit

Permalink
Merge branch 'master' into aleem/rest-latest-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
anilcse authored Dec 22, 2020
2 parents 7a2eaa2 + f9dc082 commit 02b2e05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: env.GIT_DIFF
- uses: codecov/[email protected].0
- uses: codecov/[email protected].1
with:
file: ./coverage.txt
if: env.GIT_DIFF
Expand Down
8 changes: 6 additions & 2 deletions x/simulation/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (lw *StandardLogWriter) AddEntry(opEntry OperationEntry) {
// PrintLogs - print the logs to a simulation file
func (lw *StandardLogWriter) PrintLogs() {
f := createLogFile()
defer f.Close()

for i := 0; i < len(lw.OpEntries); i++ {
writeEntry := fmt.Sprintf("%s\n", (lw.OpEntries[i]).MustMarshal())
Expand All @@ -50,15 +51,18 @@ func createLogFile() *os.File {
var f *os.File

fileName := fmt.Sprintf("%s.log", time.Now().Format("2006-01-02_15:04:05"))
folderPath := os.ExpandEnv("$HOME/.simapp/simulations")
folderPath := path.Join(os.ExpandEnv("$HOME"), ".simapp", "simulations")
filePath := path.Join(folderPath, fileName)

err := os.MkdirAll(folderPath, os.ModePerm)
if err != nil {
panic(err)
}

f, _ = os.Create(filePath)
f, err = os.Create(filePath)
if err != nil {
panic(err)
}
fmt.Printf("Logs to writing to %s\n", filePath)

return f
Expand Down

0 comments on commit 02b2e05

Please sign in to comment.