test_quick_logger 0.1.0 → 0.7.1

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: 8f2778bf77f3fa382ad4fe9b4808f92a01913149817760cdc4afa5069685c471
4
- data.tar.gz: e0c9d441f791511c0f14d95f8da4a0be3a2bd93b890e55c938318801948fd77a
3
+ metadata.gz: b27ad2352b7c62fefc95ffcd456b00ee38a2c94905fbdeadc6930a73996dc990
4
+ data.tar.gz: 1defb7d27a175c380fd5a6c71e0b7a85719cb6a063d4402ddcd68b6d46067f0e
5
5
  SHA512:
6
- metadata.gz: 29ef45a73cadd4d9bd981cb3d49d6cfb336e507f931eeeb6a91e727d10006eab2f8c8382cbed898857aff7ea2ba269ba0877067be70410369babbdf309b167d4
7
- data.tar.gz: 408a5c2f80d9778ac82addec3cd971fdf25c8a6121a09cc1692ecb5fd34cf29c8d2da4cd182e41b8d24ce803182e348664b548e11bed0150a1dddf2679b528ff
6
+ metadata.gz: c693acccf4308a0c8ae5a2edd5a445c554c413c9e4327a35667b748a3af72d2c04d44a9dda0f499946823559b6d80abf8f6228f057911a3736ea651d89d7fc84
7
+ data.tar.gz: 2dde2b148cadda1546900b735433ab48f5d00da6486643306a32e697ac5a93af06552831865781a56cf589b120af902f4f8fdab722975be7d6b6d3a93386415c
data/README.md CHANGED
@@ -6,15 +6,15 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
6
6
 
7
7
  ## Installation
8
8
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
9
+ TODO: Replace `custom_logger` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
10
 
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ $ bundle add custom_logger
14
14
 
15
15
  If bundler is not being used to manage dependencies, install the gem by executing:
16
16
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
17
+ $ gem install custom_logger
18
18
 
19
19
  ## Usage
20
20
 
@@ -2,6 +2,6 @@ module TestQuickLogger::ControllerMethods
2
2
  def logit
3
3
  return unless user_signed_in?
4
4
 
5
- TestQuickLogger.info("[#{current_user}] #{request.method.upcase} #{request.path}")
5
+ TestQuickLogger.info("\e[95m[#{current_user.username}] \e[33m#{request.method.upcase}\e[0m #{request.path}")
6
6
  end
7
7
  end
@@ -2,6 +2,8 @@ class TestQuickLogger::Railtie < ::Rails::Railtie
2
2
  initializer "test_quick_logger.configure_rails_initialization" do
3
3
  ActiveSupport.on_load(:action_controller) do
4
4
  include TestQuickLogger::ControllerMethods
5
+
6
+ before_action :logit
5
7
  end
6
8
  end
7
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestQuickLogger
4
- VERSION = "0.1.0"
4
+ VERSION = "0.7.1"
5
5
  end
@@ -2,44 +2,44 @@
2
2
 
3
3
  require_relative "test_quick_logger/version"
4
4
  require_relative "test_quick_logger/controller_methods"
5
- require_relative "pretty_logger/railtie" if defined?(Rails)
5
+ require_relative "test_quick_logger/railtie" if defined?(Rails)
6
6
 
7
7
  module TestQuickLogger
8
8
  class Error < StandardError; end
9
9
  module_function
10
10
 
11
11
  COLORS = {
12
- debug: "\e[95m",
13
- info: "\e[36m",
14
- warn: "\e[33m",
12
+ debug: "\e[90m",
13
+ info: "\e[96m",
14
+ warn: "\e[93m",
15
15
  error: "\e[31m",
16
16
  }
17
17
 
18
18
  def instance
19
- @instance ||= ::ActiveSupoort::Logger.new("log/custom.log")
19
+ @instance ||= ::ActiveSupport::Logger.new("log/custom.log")
20
20
  end
21
21
 
22
- def timestamp
23
- Time.current.in_time_zone("Mountain Time (US & Canada)").strftime("[%b %d, %I:%M:%S%P]")
24
- end
25
-
26
- def logit(level, message)
22
+ def pretty_log(level, message)
27
23
  instance.send(level, "\e[90m#{timestamp}#{COLORS[level]}[#{level.to_s[0].upcase}]\e[0m #{message}")
28
24
  end
29
25
 
30
26
  def debug(message)
31
- logit(:debug, message)
27
+ pretty_log(:debug, message)
32
28
  end
33
29
 
34
30
  def info(message)
35
- logit(:info, message)
31
+ pretty_log(:info, message)
36
32
  end
37
33
 
38
34
  def warn(message)
39
- logit(:warn, message)
35
+ pretty_log(:warn, message)
40
36
  end
41
37
 
42
38
  def error(message)
43
- logit(:error, message)
39
+ pretty_log(:error, message)
40
+ end
41
+
42
+ def timestamp
43
+ Time.current.in_time_zone("Mountain Time (US & Canada)").strftime("[%b %d, %I:%M:%S%P]")
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_quick_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocco Nicholls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-23 00:00:00.000000000 Z
11
+ date: 2024-05-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: testing gem build
13
+ description: https://github.com
14
14
  email:
15
15
  - rocco11nicholls@gmail.com
16
16
  executables: []
@@ -29,11 +29,11 @@ files:
29
29
  - lib/test_quick_logger/railtie.rb
30
30
  - lib/test_quick_logger/version.rb
31
31
  - sig/test_quick_logger.rbs
32
- homepage: https://github.com
32
+ homepage: https://github.com/repo/custom-logger
33
33
  licenses:
34
34
  - MIT
35
35
  metadata:
36
- homepage_uri: https://github.com
36
+ homepage_uri: https://github.com/repo/custom-logger
37
37
  source_code_uri: https://github.com
38
38
  changelog_uri: https://github.com
39
39
  post_install_message:
@@ -54,5 +54,5 @@ requirements: []
54
54
  rubygems_version: 3.4.1
55
55
  signing_key:
56
56
  specification_version: 4
57
- summary: testing gem build
57
+ summary: https://github.com
58
58
  test_files: []