Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
qhwa committed May 8, 2012
1 parent 1f69047 commit f21db55
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
log/*.log
3 changes: 3 additions & 0 deletions config.ru
@@ -1,7 +1,10 @@
require 'sinatra'
require 'logger'

set :env, :production

$logger = Logger.new 'log/visit.log'

if defined?(run)
disable :run
require './fdlint-host'
Expand Down
8 changes: 8 additions & 0 deletions fdlint-host.rb
Expand Up @@ -4,10 +4,12 @@
require 'haml'
require 'base64'
require 'json'
require 'logger'
require_relative 'lib/fdlint/lib/runner'
require_relative 'app/helper/readstr'

$runner = XRay::Runner.new
$logger ||= Logger.new(STDOUT)

configure do
set :views, File.dirname(__FILE__) << '/app/view'
Expand Down Expand Up @@ -39,6 +41,9 @@ def css(path)
end
text, encoding = readstr(bin)

$logger.info "receive post #{params}"
t = Time.now

if name
result = $runner.send("check", text, name)
else
Expand All @@ -47,6 +52,9 @@ def css(path)

@result = format_result name, text, result

t = (Time.now - t)*1000
$logger.info "time elapsed: %d ms" % t

if params['format'] == 'html'
@src = text
haml :home
Expand Down
Empty file added log/.gitkeep
Empty file.

0 comments on commit f21db55

Please sign in to comment.