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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/demopass/logger.rb +39 -0
- data/lib/demopass/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b93fc6592804b37e45b73ceb100fd808b7c166e0e4ccf4f4146c706d02f26e9
|
4
|
+
data.tar.gz: 511822f5978a5b01b0a9e740251aa30b82d49505e3b13bf263e8ab9a8ace2feb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61064766ef8b2fd2233dda8cf0963ff18ea42cbd4977e68cff3b11608aff92195bb29c1e8910e694f6d920bc1faf70184bf37cb024d50202a7fac69ddd2f33e7
|
7
|
+
data.tar.gz: ff53eb375e7310ecffc9f84ee4c5c5c9468a00fc6d56804d42bc613686abddb3545ad7b829fc94e09bc96471b910b9c207f8cdee9f0bc6e7ff70ce584f04a0f5
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/demopass/version.rb
CHANGED
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.
|
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: []
|