Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3b87cde4
Commit
3b87cde4
authored
Aug 26, 2019
by
Ash McKenzie
Committed by
Douglas Barbosa Alexandre
Aug 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Allow Geo log cursor to log output to stdout
parent
a6ce154e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
ee/bin/geo_log_cursor
ee/bin/geo_log_cursor
+1
-7
ee/lib/gitlab/geo/logger.rb
ee/lib/gitlab/geo/logger.rb
+6
-0
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
+13
-1
No files found.
ee/bin/geo_log_cursor
View file @
3b87cde4
...
...
@@ -41,12 +41,6 @@ class GeoLogCursorOptionParser
end
end
module
StdoutLogger
def
full_log_path
STDOUT
end
end
if
$0
==
__FILE__
options
=
GeoLogCursorOptionParser
.
parse
(
ARGV
)
...
...
@@ -57,7 +51,7 @@ if $0 == __FILE__
# Monkey patch the logging class because multiple places use it (that
# contain mostly class methods) and is not possible to pass
# options[:stdout_logging] around without a refactor.
Gitlab
::
Geo
::
Logger
.
extend
(
StdoutLogger
)
Gitlab
::
Geo
::
Logger
.
extend
(
Gitlab
::
Geo
::
Logger
::
StdoutLogger
)
end
Gitlab
::
Geo
::
LogCursor
::
Daemon
.
new
(
options
).
run!
...
...
ee/lib/gitlab/geo/logger.rb
View file @
3b87cde4
...
...
@@ -3,6 +3,12 @@
module
Gitlab
module
Geo
class
Logger
<
::
Gitlab
::
JsonLogger
module
StdoutLogger
def
full_log_path
$stdout
end
end
def
self
.
file_name_noext
'geo'
end
...
...
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
View file @
3b87cde4
require
'spec_helper'
describe
Gitlab
::
Geo
::
LogCursor
::
Logger
do
describe
Gitlab
::
Geo
::
LogCursor
::
Logger
,
:geo
do
class
LoggerSpec
;
end
subject
(
:logger
)
{
described_class
.
new
(
LoggerSpec
)
}
...
...
@@ -39,4 +39,16 @@ describe Gitlab::Geo::LogCursor::Logger do
logger
.
event_info
(
Time
.
now
,
'Test'
)
end
end
context
'when class is extended with StdoutLogger'
do
it
'logs to stdout'
do
message
=
'this message should appear on stdout'
Gitlab
::
Geo
::
Logger
.
extend
(
Gitlab
::
Geo
::
Logger
::
StdoutLogger
)
# This is needed because otherwise https://gitlab.com/gitlab-org/gitlab-ee/blob/master/config/environments/test.rb#L52
# sets the default logging level to :fatal when running under CI
allow
(
Rails
.
logger
).
to
receive
(
:level
).
and_return
(
:info
)
expect
{
logger
.
info
(
message
)
}.
to
output
(
/
#{
message
}
/
).
to_stdout
end
end
end
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