# File lib/logging/appender.rb, line 35
  def initialize( name, opts = {} )
    ::Logging.init unless ::Logging.const_defined? :MAX_LEVEL_LENGTH

    @name = name.to_s
    @closed = false

    self.layout = opts.getopt(:layout, ::Logging::Layouts::Basic.new)
    self.level = opts.getopt(:level)

    @mutex = ReentrantMutex.new
    header = @layout.header

    unless header.nil? || header.empty?
      begin 
        sync {write(header)}
      rescue StandardError => err
        ::Logging.log_internal(-2) {err}
      end
    end

    ::Logging::Appenders[@name] = self
  end