Sha256: 29010e6275ff80c420e6f69bf589e7551dd035d8d32946bc422089fe05c3ec7b

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8
require 'socket'
require_relative 'logdna/client.rb'
require_relative 'logdna/resources.rb'
module Logdna
    class Ruby
        def initialize(key, opts={})
            @@client = Logdna::Client.new(key, opts)
            sleep 0.0001
            if @@client[:value] === Resources::LOGGER_NOT_CREATED
                @@client = nil
                puts "LogDNA logger not created"
                return
            end
        end

        def log(msg, opts={})
            if @@client === nil
                puts "Logger Not Initialized Yet"
                return
            end
            @response = @@client.tobuffer(msg, opts)
            'Saved'
        end

        at_exit do
            unless @@client === nil
                @@client.exitout()
            end
            exit!
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logdna-1.0.2 lib/logdna.rb
logdna-1.0.1 lib/logdna.rb