Sha256: 145dab9383c3e3c595131f175488609e599eaa34104d8e41ceb8c7b9088171c7

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.expand_path("../../lib", __FILE__)
require 'zlogger'
require 'optparse'

# Process options
options = {}

opts = OptionParser.new do |opts|
  opts.banner = "Usage: #{$0} [options]"

  opts.separator ""
  opts.separator "Specific options:"

  opts.on("-b", "--bind ADDRESS",
          "TCP address to bind to, defaults to 0.0.0.0") do |ext|
    options[:bind_address] = ext
  end

  opts.on("-p", "--port PORT", Integer, "Port number to bind to") do |n|
    options[:port] = n
  end

  opts.on("-f", '--file FILE', String, "File to write the log to. File is stored under /log folder") do |file|
    options[:output] = file
  end

  opts.on("-r", '--rotate', String, "Rotate log file daily") do |file|
    options[:rotate] = true
  end

  opts.on("-s", "--stdout", "Echo output to STDOUT (only applicable when -f is used)") do
    options[:stdout] = true
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end

  opts.on_tail("-v", "--version", "Show version") do
    puts "Zlogger version #{Zlogger::VERSION}"
    exit
  end
end

opts.parse!(ARGV)

# Create Zlogger

logger = Zlogger::Daemon.new(options)
logger.run

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zlogger-0.1.0 bin/zloggerd
zlogger-0.0.2 bin/zloggerd