Skip to content

Commit

Permalink
Merge pull request #19 from blp1526/setflags
Browse files Browse the repository at this point in the history
Add log.SetFlags(0)
  • Loading branch information
blp1526 authored Jul 23, 2017
2 parents cc43c8e + 4e52012 commit b8b2fbc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 34 deletions.
3 changes: 0 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"time"

"github.com/blp1526/scv/config"
"github.com/blp1526/scv/logger"
)

type Body struct {
Expand All @@ -34,7 +33,6 @@ func Request(body *Body, zoneName string, serverName string) error {
serverId = scv.Servers[i].ID
}
}
logger.Debug(fmt.Sprintf("Server ID: %s", serverId))

if serverId == "" {
return fmt.Errorf("ServerID is not found by ZoneName %s and ServerName %s", zoneName, serverName)
Expand All @@ -45,7 +43,6 @@ func Request(body *Body, zoneName string, serverName string) error {
host := "secure.sakura.ad.jp"
path := "/cloud/zone/" + zoneName + "/api/cloud/1.1/server/" + serverId + "/vnc/proxy"
url := scheme + "://" + host + path
logger.Debug(fmt.Sprintf("URL: %s", url))

req, err := http.NewRequest("GET", url, nil)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions color/color.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package color

func Red(msg string) string {
return format("\033[31m", msg)
}

func format(color string, msg string) string {
return color + msg + "\033[m"
}
27 changes: 0 additions & 27 deletions logger/logger.go

This file was deleted.

8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package main

import (
"fmt"
"os"
"log"

"github.com/blp1526/scv/cmd"
"github.com/blp1526/scv/logger"
"github.com/blp1526/scv/color"
)

func main() {
msg, err := cmd.Run()
if err != nil {
logger.Fatal(fmt.Sprintf("%s", err))
os.Exit(1)
log.SetFlags(0)
log.Fatal(color.Red(fmt.Sprintf("fatal: %s", err)))
} else {
fmt.Println(msg)
}
Expand Down

0 comments on commit b8b2fbc

Please sign in to comment.