Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
e5f4130a
Commit
e5f4130a
authored
May 16, 2013
by
ash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the logger and related configuration options.
parent
5519420e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
lib/gitlab_config.rb
lib/gitlab_config.rb
+8
-0
lib/gitlab_logger.rb
lib/gitlab_logger.rb
+16
-0
No files found.
lib/gitlab_config.rb
View file @
e5f4130a
...
@@ -31,6 +31,14 @@ class GitlabConfig
...
@@ -31,6 +31,14 @@ class GitlabConfig
redis
[
'namespace'
]
||
'resque:gitlab'
redis
[
'namespace'
]
||
'resque:gitlab'
end
end
def
log_file
@config
[
'log_file'
]
||=
File
.
join
(
ROOT_PATH
,
'log'
,
'gitlab_shell.log'
)
end
def
log_level
@config
[
'log_level'
]
||=
'INFO'
end
# Build redis command to write update event in gitlab queue
# Build redis command to write update event in gitlab queue
def
redis_command
def
redis_command
if
redis
.
empty?
if
redis
.
empty?
...
...
lib/gitlab_logger.rb
0 → 100644
View file @
e5f4130a
require
'logger'
require_relative
'gitlab_config'
def
convert_log_level
log_level
Logger
.
const_get
(
log_level
.
upcase
)
rescue
NameError
$stderr
.
puts
"WARNING: Unrecognized log level
#{
log_level
.
inspect
}
."
$stderr
.
puts
"WARNING: Falling back to INFO."
Logger
::
INFO
end
config
=
GitlabConfig
.
new
$logger
=
Logger
.
new
(
config
.
log_file
)
$logger
.
level
=
convert_log_level
(
config
.
log_level
)
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