Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
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
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
gitlab-runner
Commits
01804eb8
Verified
Commit
01804eb8
authored
6 years ago
by
Tomasz Maczukin
Browse files
Options
Downloads
Patches
Plain Diff
Remove unneeded alias for logrus import
parent
58e1803a
No related branches found
No related tags found
1 merge request
!1020
Support json logging
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
commands/multi.go
+15
-15
15 additions, 15 deletions
commands/multi.go
with
15 additions
and
15 deletions
commands/multi.go
+
15
−
15
View file @
01804eb8
...
...
@@ -15,7 +15,7 @@ import (
"github.com/ayufan/golang-kardianos-service"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"gitlab.com/gitlab-org/gitlab-runner/common"
...
...
@@ -55,7 +55,7 @@ type RunCommand struct {
ServiceName
string
`short:"n" long:"service" description:"Use different names for different services"`
WorkingDirectory
string
`short:"d" long:"working-directory" description:"Specify custom working directory"`
User
string
`short:"u" long:"user" description:"Use specific user to execute shell scripts"`
Syslog
bool
`long:"syslog" description:"Log to sys
log
"`
Syslog
bool
`long:"syslog" description:"Log to sys
tem service logger" env:"LOG_SYSLOG
"`
sentryLogHook
sentry
.
LogHook
prometheusLogHook
prometheus_helper
.
LogHook
...
...
@@ -88,8 +88,8 @@ type RunCommand struct {
currentWorkers
int
}
func
(
mr
*
RunCommand
)
log
()
*
log
.
Entry
{
return
log
.
WithField
(
"builds"
,
mr
.
buildsHelper
.
buildsCount
())
func
(
mr
*
RunCommand
)
log
()
*
log
rus
.
Entry
{
return
log
rus
.
WithField
(
"builds"
,
mr
.
buildsHelper
.
buildsCount
())
}
func
(
mr
*
RunCommand
)
feedRunner
(
runner
*
common
.
RunnerConfig
,
runners
chan
*
common
.
RunnerConfig
)
{
...
...
@@ -140,7 +140,7 @@ func (mr *RunCommand) processRunner(id int, runner *common.RunnerConfig, runners
context
,
err
:=
provider
.
Acquire
(
runner
)
if
err
!=
nil
{
log
.
Warningln
(
"Failed to update executor"
,
runner
.
Executor
,
"for"
,
runner
.
ShortDescription
(),
err
)
log
rus
.
Warningln
(
"Failed to update executor"
,
runner
.
Executor
,
"for"
,
runner
.
ShortDescription
(),
err
)
return
}
defer
provider
.
Release
(
runner
,
context
)
...
...
@@ -260,11 +260,11 @@ func (mr *RunCommand) loadConfig() error {
// Set log level
if
!
cli_helpers
.
CustomLogLevelSet
&&
mr
.
config
.
LogLevel
!=
nil
{
level
,
err
:=
log
.
ParseLevel
(
*
mr
.
config
.
LogLevel
)
level
,
err
:=
log
rus
.
ParseLevel
(
*
mr
.
config
.
LogLevel
)
if
err
!=
nil
{
log
.
Fatalf
(
err
.
Error
())
log
rus
.
Fatalf
(
err
.
Error
())
}
log
.
SetLevel
(
level
)
log
rus
.
SetLevel
(
level
)
}
// pass user to execute scripts as specific user
...
...
@@ -640,25 +640,25 @@ func (mr *RunCommand) Execute(context *cli.Context) {
service
,
err
:=
service_helpers
.
New
(
mr
,
svcConfig
)
if
err
!=
nil
{
log
.
Fatalln
(
err
)
log
rus
.
Fatalln
(
err
)
}
if
mr
.
Syslog
{
log
.
SetFormatter
(
new
(
log
.
TextFormatter
))
log
rus
.
SetFormatter
(
new
(
log
rus
.
TextFormatter
))
logger
,
err
:=
service
.
SystemLogger
(
nil
)
if
err
==
nil
{
log
.
AddHook
(
&
ServiceLogHook
{
logger
,
log
.
InfoLevel
})
log
rus
.
AddHook
(
&
ServiceLogHook
{
logger
,
log
rus
.
InfoLevel
})
}
else
{
log
.
Errorln
(
err
)
log
rus
.
Errorln
(
err
)
}
}
log
.
AddHook
(
&
mr
.
sentryLogHook
)
log
.
AddHook
(
&
mr
.
prometheusLogHook
)
log
rus
.
AddHook
(
&
mr
.
sentryLogHook
)
log
rus
.
AddHook
(
&
mr
.
prometheusLogHook
)
err
=
service
.
Run
()
if
err
!=
nil
{
log
.
Fatalln
(
err
)
log
rus
.
Fatalln
(
err
)
}
}
...
...
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