Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
15aeb4ae
Commit
15aeb4ae
authored
Jun 03, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(cli): rename log to logger to separate from server logger
parent
4c4189d6
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
27 deletions
+29
-27
pkg/cmd/grafana-cli/commands/commands.go
+4
-4
pkg/cmd/grafana-cli/commands/install_command.go
+6
-5
pkg/cmd/grafana-cli/commands/listremote_command.go
+2
-2
pkg/cmd/grafana-cli/commands/ls_command.go
+4
-4
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
+2
-2
pkg/cmd/grafana-cli/commands/upgrade_command.go
+2
-2
pkg/cmd/grafana-cli/logger/logger.go
+1
-1
pkg/cmd/grafana-cli/main.go
+6
-5
pkg/cmd/grafana-cli/services/services.go
+2
-2
No files found.
pkg/cmd/grafana-cli/commands/commands.go
View file @
15aeb4ae
...
...
@@ -5,7 +5,7 @@ import (
"github.com/codegangsta/cli"
"github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
)
func
runCommand
(
command
func
(
commandLine
CommandLine
)
error
)
func
(
context
*
cli
.
Context
)
{
...
...
@@ -13,13 +13,13 @@ func runCommand(command func(commandLine CommandLine) error) func(context *cli.C
cmd
:=
&
contextCommandLine
{
context
}
if
err
:=
command
(
cmd
);
err
!=
nil
{
log
.
Errorf
(
"
\n
%s: "
,
color
.
RedString
(
"Error"
))
log
.
Errorf
(
"%s
\n\n
"
,
err
)
log
ger
.
Errorf
(
"
\n
%s: "
,
color
.
RedString
(
"Error"
))
log
ger
.
Errorf
(
"%s
\n\n
"
,
err
)
cmd
.
ShowHelp
()
os
.
Exit
(
1
)
}
else
{
log
.
Info
(
"
\n
Restart grafana after installing plugins . <service grafana-server restart>
\n\n
"
)
log
ger
.
Info
(
"
\n
Restart grafana after installing plugins . <service grafana-server restart>
\n\n
"
)
}
}
}
...
...
pkg/cmd/grafana-cli/commands/install_command.go
View file @
15aeb4ae
...
...
@@ -14,9 +14,10 @@ import (
"strings"
"github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/lunny/log"
)
func
validateInput
(
c
CommandLine
,
pluginFolder
string
)
error
{
...
...
@@ -78,10 +79,10 @@ func InstallPlugin(pluginName, version string, c CommandLine) error {
pluginName
,
version
)
log
.
Infof
(
"installing %v @ %v
\n
"
,
plugin
.
Id
,
version
)
log
.
Infof
(
"from url: %v
\n
"
,
downloadURL
)
log
.
Infof
(
"into: %v
\n
"
,
pluginFolder
)
log
.
Info
(
"
\n
"
)
log
ger
.
Infof
(
"installing %v @ %v
\n
"
,
plugin
.
Id
,
version
)
log
ger
.
Infof
(
"from url: %v
\n
"
,
downloadURL
)
log
ger
.
Infof
(
"into: %v
\n
"
,
pluginFolder
)
log
ger
.
Info
(
"
\n
"
)
err
=
downloadFile
(
plugin
.
Id
,
pluginFolder
,
downloadURL
)
if
err
!=
nil
{
...
...
pkg/cmd/grafana-cli/commands/listremote_command.go
View file @
15aeb4ae
package
commands
import
(
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
...
...
@@ -18,7 +18,7 @@ func listremoteCommand(c CommandLine) error {
pluginVersion
=
i
.
Versions
[
0
]
.
Version
}
log
.
Infof
(
"id: %v version: %s
\n
"
,
i
.
Id
,
pluginVersion
)
log
ger
.
Infof
(
"id: %v version: %s
\n
"
,
i
.
Id
,
pluginVersion
)
}
return
nil
...
...
pkg/cmd/grafana-cli/commands/ls_command.go
View file @
15aeb4ae
...
...
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
...
...
@@ -17,7 +17,7 @@ var validateLsCommand = func(pluginDir string) error {
return
errors
.
New
(
"missing path flag"
)
}
log
.
Debug
(
"plugindir: "
+
pluginDir
+
"
\n
"
)
log
ger
.
Debug
(
"plugindir: "
+
pluginDir
+
"
\n
"
)
pluginDirInfo
,
err
:=
s
.
IoHelper
.
Stat
(
pluginDir
)
if
err
!=
nil
{
...
...
@@ -40,11 +40,11 @@ func lsCommand(c CommandLine) error {
plugins
:=
ls_getPlugins
(
pluginDir
)
if
len
(
plugins
)
>
0
{
log
.
Info
(
"installed plugins:
\n
"
)
log
ger
.
Info
(
"installed plugins:
\n
"
)
}
for
_
,
plugin
:=
range
plugins
{
log
.
Infof
(
"%s %s %s
\n
"
,
plugin
.
Id
,
color
.
YellowString
(
"@"
),
plugin
.
Info
.
Version
)
log
ger
.
Infof
(
"%s %s %s
\n
"
,
plugin
.
Id
,
color
.
YellowString
(
"@"
),
plugin
.
Info
.
Version
)
}
return
nil
...
...
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
View file @
15aeb4ae
package
commands
import
(
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/hashicorp/go-version"
...
...
@@ -51,7 +51,7 @@ func upgradeAllCommand(c CommandLine) error {
}
for
_
,
p
:=
range
pluginsToUpgrade
{
log
.
Infof
(
"Updating %v
\n
"
,
p
.
Id
)
log
ger
.
Infof
(
"Updating %v
\n
"
,
p
.
Id
)
s
.
RemoveInstalledPlugin
(
pluginsDir
,
p
.
Id
)
InstallPlugin
(
p
.
Id
,
""
,
c
)
...
...
pkg/cmd/grafana-cli/commands/upgrade_command.go
View file @
15aeb4ae
...
...
@@ -2,7 +2,7 @@ package commands
import
(
"github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
...
...
@@ -27,6 +27,6 @@ func upgradeCommand(c CommandLine) error {
return
InstallPlugin
(
localPlugin
.
Id
,
""
,
c
)
}
log
.
Infof
(
"%s %s is up to date
\n
"
,
color
.
GreenString
(
"✔"
),
localPlugin
.
Id
)
log
ger
.
Infof
(
"%s %s is up to date
\n
"
,
color
.
GreenString
(
"✔"
),
localPlugin
.
Id
)
return
nil
}
pkg/cmd/grafana-cli/log
/log
.go
→
pkg/cmd/grafana-cli/log
ger/logger
.go
View file @
15aeb4ae
package
log
package
log
ger
import
(
"fmt"
...
...
pkg/cmd/grafana-cli/main.go
View file @
15aeb4ae
...
...
@@ -7,7 +7,8 @@ import (
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
"github.com/lunny/log"
)
var
version
=
"master"
...
...
@@ -42,7 +43,7 @@ func isDevenvironment(pwd string) bool {
}
func
main
()
{
S
etupLogging
()
s
etupLogging
()
app
:=
cli
.
NewApp
()
app
.
Name
=
"Grafana cli"
...
...
@@ -73,14 +74,14 @@ func main() {
app
.
CommandNotFound
=
cmdNotFound
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
log
.
Errorf
(
"%v"
,
err
)
log
ger
.
Errorf
(
"%v"
,
err
)
}
}
func
S
etupLogging
()
{
func
s
etupLogging
()
{
for
_
,
f
:=
range
os
.
Args
{
if
f
==
"-D"
||
f
==
"--debug"
||
f
==
"-debug"
{
log
.
SetDebug
(
true
)
log
ger
.
SetDebug
(
true
)
}
}
}
...
...
pkg/cmd/grafana-cli/services/services.go
View file @
15aeb4ae
...
...
@@ -7,7 +7,7 @@ import (
"path"
"github.com/franela/goreq"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log
ger
"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
)
...
...
@@ -64,7 +64,7 @@ func GetLocalPlugins(pluginDir string) []m.InstalledPlugin {
}
func
RemoveInstalledPlugin
(
pluginPath
,
id
string
)
error
{
log
.
Infof
(
"Removing plugin: %v
\n
"
,
id
)
log
ger
.
Infof
(
"Removing plugin: %v
\n
"
,
id
)
return
IoHelper
.
RemoveAll
(
path
.
Join
(
pluginPath
,
id
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment