Commit 871eba78 authored by Ash McKenzie's avatar Ash McKenzie

Geo: Allow Geo log cursor to log output to stdout

parent dc220a3d
......@@ -19,6 +19,7 @@ class GeoLogCursorOptionParser
op.separator 'Usage: ./geo_log_cursor [options]'
op.separator ''
op.on('-d', '--debug', 'Enable detailed logging with extra debug information') { options[:debug] = true }
op.on('--stdout-logging', 'Log output to stdout') { options[:stdout_logging] = true }
op.separator 'Common options:'
op.on('-h', '--help') do
......@@ -40,11 +41,24 @@ class GeoLogCursorOptionParser
end
end
module StdoutLogger
def full_log_path
STDOUT
end
end
if $0 == __FILE__
options = GeoLogCursorOptionParser.parse(ARGV)
# We load rails environment / initializers only here to get faster command line startup when `--help` and `--version`
require rails_path('config/environment.rb')
if options[:stdout_logging]
# 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)
end
Gitlab::Geo::LogCursor::Daemon.new(options).run!
end
---
title: "Geo: Don't wait when exiting the log cursor"
merge_request: 15070
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment