Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gitlab-runner-do-monitor
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Server Tools
gitlab-runner-do-monitor
Commits
187f6d9f
Commit
187f6d9f
authored
3 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Fix logger setup
parent
07da54de
No related branches found
Branches containing commit
No related tags found
1 merge request
!5
Add go.mod
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
glrdomon.go
+3
-5
3 additions, 5 deletions
glrdomon.go
glrdomon_test.go
+1
-1
1 addition, 1 deletion
glrdomon_test.go
with
4 additions
and
6 deletions
glrdomon.go
+
3
−
5
View file @
187f6d9f
...
@@ -30,8 +30,7 @@ type tokenSource struct {
...
@@ -30,8 +30,7 @@ type tokenSource struct {
var
(
var
(
configPath
string
configPath
string
logger
*
log
.
Logger
logger
*
log
.
Logger
logDest
string
apiKey
string
apiKey
string
threshold
int
threshold
int
...
@@ -64,8 +63,7 @@ func initConfig() {
...
@@ -64,8 +63,7 @@ func initConfig() {
threshold
=
cfg
.
Threshold
threshold
=
cfg
.
Threshold
deleteStale
=
cfg
.
DeleteStale
deleteStale
=
cfg
.
DeleteStale
logDest
=
cfg
.
LogDest
setUpLogger
(
cfg
.
LogDest
)
setUpLogger
()
logger
.
Printf
(
"Starting GitLab Runner monitoring with config %s"
,
configPath
)
logger
.
Printf
(
"Starting GitLab Runner monitoring with config %s"
,
configPath
)
...
@@ -194,7 +192,7 @@ func deleteDroplet(droplet godo.Droplet) bool {
...
@@ -194,7 +192,7 @@ func deleteDroplet(droplet godo.Droplet) bool {
return
err
==
nil
return
err
==
nil
}
}
func
setUpLogger
()
{
func
setUpLogger
(
logDest
string
)
{
logOpts
:=
log
.
Ldate
|
log
.
Ltime
|
log
.
LUTC
|
log
.
Lshortfile
logOpts
:=
log
.
Ldate
|
log
.
Ltime
|
log
.
LUTC
|
log
.
Lshortfile
if
logDest
==
"os.Stdout"
{
if
logDest
==
"os.Stdout"
{
...
...
This diff is collapsed.
Click to expand it.
glrdomon_test.go
+
1
−
1
View file @
187f6d9f
...
@@ -8,7 +8,7 @@ import (
...
@@ -8,7 +8,7 @@ import (
)
)
func
TestCheckDropletAge
(
t
*
testing
.
T
)
{
func
TestCheckDropletAge
(
t
*
testing
.
T
)
{
setUpLogger
()
setUpLogger
(
"os.stdOut"
)
staleDroplet
:=
godo
.
Droplet
{
staleDroplet
:=
godo
.
Droplet
{
ID
:
1234
,
ID
:
1234
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment