File: logging.rb

package info (click to toggle)
ruby-asciidoctor-include-ext 0.4.0%2Bgh-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 407; makefile: 3; ml: 1
file content (21 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true
require 'logger'
require 'asciidoctor'
require 'asciidoctor/include_ext/version'

module Asciidoctor::IncludeExt
  # Helper module for getting default Logger based on the Asciidoctor version.
  module Logging
    module_function

    # @return [Logger] the default `Asciidoctor::Logger` if using Asciidoctor
    #   1.5.7 or later, or Ruby's `Logger` that outputs to `STDERR`.
    def default_logger
      if defined? ::Asciidoctor::LoggerManager
        ::Asciidoctor::LoggerManager.logger
      else
        ::Logger.new(STDERR)
      end
    end
  end
end