demopass 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ac8f48f70d6ffcf528b814bb9165d2d97d5d29e31121ec7a913759f4c114949
4
- data.tar.gz: e3ec2d88ae0bdcabea6aba343a38cfd1f586d4158eb41168e3ba4f3ea85b8502
3
+ metadata.gz: 6b93fc6592804b37e45b73ceb100fd808b7c166e0e4ccf4f4146c706d02f26e9
4
+ data.tar.gz: 511822f5978a5b01b0a9e740251aa30b82d49505e3b13bf263e8ab9a8ace2feb
5
5
  SHA512:
6
- metadata.gz: e319207646f43ce1110f84cbdb8da9b81be65f17e50ec9c4e58e9fc379f0491c104637188900546792b93af861a5b0e4bf532afdbf400bae0a7b890dc35f57e7
7
- data.tar.gz: 6aad313c06b3e9b3b5d845040fb2ff068c96be208a46c5a1757e726653ab0ca3241da06b593d10eaf1ab05df21740904c11b45d27b4da6a5443db48ca1439270
6
+ metadata.gz: 61064766ef8b2fd2233dda8cf0963ff18ea42cbd4977e68cff3b11608aff92195bb29c1e8910e694f6d920bc1faf70184bf37cb024d50202a7fac69ddd2f33e7
7
+ data.tar.gz: ff53eb375e7310ecffc9f84ee4c5c5c9468a00fc6d56804d42bc613686abddb3545ad7b829fc94e09bc96471b910b9c207f8cdee9f0bc6e7ff70ce584f04a0f5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- demopass (0.2.1)
4
+ demopass (0.2.2)
5
5
  rack
6
6
 
7
7
  GEM
@@ -0,0 +1,39 @@
1
+ require "logger"
2
+
3
+ class Demopass::Logger
4
+ def initialize(log_level: nil)
5
+ log_level ||= env_log_level || rails_log_level || default_log_level
6
+ return if log_level == :none
7
+
8
+ @logger = ::Logger.new($stdout, level: log_level, progname: "Demopass")
9
+ end
10
+
11
+ def debug(message)
12
+ log(message, log_level: ::Logger::DEBUG)
13
+ end
14
+
15
+ def info(message)
16
+ log(message, log_level: ::Logger::INFO)
17
+ end
18
+
19
+ private
20
+
21
+ def log(message, log_level:)
22
+ @logger&.add(log_level, message, "Demopass")
23
+ end
24
+
25
+ def env_log_level
26
+ case ENV["LOG_LEVEL"]
27
+ when "debug", "info", "warn", "error", "fatal"
28
+ ENV["LOG_LEVEL"]
29
+ end
30
+ end
31
+
32
+ def default_log_level
33
+ ::Logger::INFO
34
+ end
35
+
36
+ def rails_log_level
37
+ Rails.logger.level if defined?(Rails)
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Demopass
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demopass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
@@ -144,6 +144,7 @@ files:
144
144
  - demopass.gemspec
145
145
  - lib/demopass.rb
146
146
  - lib/demopass/app.rb
147
+ - lib/demopass/logger.rb
147
148
  - lib/demopass/version.rb
148
149
  homepage: https://github.com/SmartCasual/demopass
149
150
  licenses: []