summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2024-10-01 12:42:54 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2024-10-01 12:43:07 +0200
commit1ae6b46450d0a3f0fa9a1a26642a7bff1586ba0a (patch)
tree1a050eee35c6ba79a2d9293e1adecb809fafb4e4 /lib
parentaea9ad38ec9097430787464c33f322b5239cd699 (diff)
downloadzorglub-1ae6b46450d0a3f0fa9a1a26642a7bff1586ba0a.zip
zorglub-1ae6b46450d0a3f0fa9a1a26642a7bff1586ba0a.tar.gz
Node : debug to stout instead of stderr
Diffstat (limited to 'lib')
-rw-r--r--lib/zorglub/node.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index a6159c3..83947fd 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -229,7 +229,7 @@ module Zorglub
def call(env)
meth, *args = env['PATH_INFO'].sub(%r{^/+}, '').split(%r{/})
meth ||= 'index'
- $stderr << "=> #{meth}(#{args.join ','})\n" if app.opt :debug
+ $stdout << "=> #{meth}(#{args.join ','})\n" if app.opt :debug
node = new(env, meth, args)
return error404 node, meth unless node.respond_to? meth
@@ -245,7 +245,7 @@ module Zorglub
end
def error404(node, meth)
- $stderr << " !! #{node.class.name}::#{meth} not found\n" if app.opt :debug
+ $stdout << " !! #{node.class.name}::#{meth} not found\n" if app.opt :debug
resp = node.response
resp.status = 404
resp['content-type'] = 'text/plain'
@@ -300,7 +300,7 @@ module Zorglub
def static_page!(path)
if File.exist?(path) && (@cache_lifetime.nil? || @cache_lifetime.zero? ||
(Time.now - File.stat(path).mtime) < @cache_lifetime)
- $stderr << " * use cache file : #{path}\n" if @debug
+ $stdout << " * use cache file : #{path}\n" if @debug
content = File.read(path)
@content = content.sub(/^@mime:(.*)\n/, '')
@mime = ::Regexp.last_match(1)
@@ -308,7 +308,7 @@ module Zorglub
compile_page!
FileUtils.mkdir_p File.dirname(path)
File.open(path, 'w') { |f| f.write("@mime:#{@mime}\n#{@content}") }
- $stderr << " * cache file created : #{path}\n" if @debug
+ $stdout << " * cache file created : #{path}\n" if @debug
end
end
@@ -317,9 +317,9 @@ module Zorglub
v = view
l = layout
if @debug
- $stderr << " * #{e ? 'use engine' : 'no engine '} : #{e ? e.to_s : ''}\n"
- $stderr << " * #{l && File.exist?(l) ? 'use layout' : 'no layout '} : #{l || ''}\n"
- $stderr << " * #{v && File.exist?(v) ? 'use view ' : 'no view '} : #{v || ''}\n"
+ $stdout << " * #{e ? 'use engine' : 'no engine '} : #{e ? e.to_s : ''}\n"
+ $stdout << " * #{l && File.exist?(l) ? 'use layout' : 'no layout '} : #{l || ''}\n"
+ $stdout << " * #{v && File.exist?(v) ? 'use view ' : 'no view '} : #{v || ''}\n"
end
@state = @partial ? :partial : :view
@content, mime = e.call(v, self) if e && v && File.exist?(v)