Skip to content

Commit

Permalink
Logging updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Nov 21, 2015
1 parent de08c44 commit 7452d73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@
/.rbx/
/spec/w3c-rdf
*.lock
*.byebug_history
5 changes: 3 additions & 2 deletions lib/rdf/rdfxml/reader.rb
Expand Up @@ -157,9 +157,10 @@ def initialize(input = $stdin, options = {}, &block)
end
self.extend(@implementation)

input.rewind if input.respond_to?(:rewind)
initialize_xml(input, options) rescue log_fatal($!.message)

log_fatal("Empty document", exception: RDF::ReaderError) if root.nil? && validate?
log_error("Empty document") if root.nil?
log_error("Synax errors") {doc_errors} if !doc_errors.empty?

block.call(self) if block_given?
Expand All @@ -182,8 +183,8 @@ def each_statement(&block)
if block_given?
# Block called from add_statement
@callback = block
return unless root


log_fatal "root must be a proxy not a #{root.class}" unless root.is_a?(@implementation::NodeProxy)

add_debug(root, "base_uri: #{base_uri.inspect}")
Expand Down
4 changes: 2 additions & 2 deletions lib/rdf/rdfxml/writer.rb
Expand Up @@ -266,7 +266,7 @@ def render_property(predicate, objects, options = {}, &block)
object: objects.first,
predicate: predicate,
property: get_qname(predicate),
recurse: @options[:log_depth] <= @max_depth
recurse: log_depth <= @max_depth
}.merge(options)
hamlify(template, options, &block)
end
Expand All @@ -293,7 +293,7 @@ def render_collection(predicate, list, options = {}, &block)
list: list,
predicate: predicate,
property: get_qname(predicate),
recurse: @options[:log_depth] <= @max_depth,
recurse: log_depth <= @max_depth,
}.merge(options)
hamlify(template, options) do |object|
yield object
Expand Down

0 comments on commit 7452d73

Please sign in to comment.