znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# file::    cmd_syslog.rb

# This source code copyright (C) 2009 Craig Smith
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#

module Cmd

  bindtextdomain("cmd")

  # Shows the system log
  def cmd_syslog(args)
	sendto("Loading log file...")
	max = 20
	max = args.to_i if args.to_i > 0
	lines = []
	File.open(options['logfile'], "r").each { |l| lines << l }
	revlines = []
	cnt = 1
	lines.reverse.each do |l| 
	    if not l=~/\[DEBUG\]/
		if cnt <= max
			revlines << l
		end
		cnt += 1
	    end
	end
	msg = ""
	revlines.reverse.each do |l|
		if l.size > 70
			msg << "#{l[0,67]}...\n"
		else
			msg << l
		end
	end
	if msg.size > 0
		msg = Msg.new(msg)
		msg.no_parse = true
		sendto(msg)
	else
		sendto _("No messages in syslog.")
	end
  end

end