cprl 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0f25f5f48e210c1c7bb4338f7cb04079fa80f077eb937343f7281ada0903fed2
4
+ data.tar.gz: 9fe0e0326c57f23786571680642adf58bcc0c7ef8866da8c2c9a371632a05a24
5
+ SHA512:
6
+ metadata.gz: 6783c7a13dffbc193bb869b6e46f1bdc3d6561731b6caf7bd60116bc4993f02c72fb65ae2e28bfc6cc842b3ce68ae808ef72ba1bc781138a27f8f0cf2d7792bf
7
+ data.tar.gz: aa540809acef0e446499b11df4d52a51f069cd4eb053bc261122ee7ccd2abe634052515e5fcae2ebedd423cce29d49ccb9c04357d1b6236e6ad8e2c76a9320e1
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # CPRL ๐Ÿ”ง๐Ÿ’ฌ
2
+
3
+ **CPRL** (Console Print with Rich Logs) is a Ruby gem that displays log messages in the console using **colors** and **emojis**.
4
+
5
+ Accessible from **models**, **controllers**, **views**, **Rails console**, and scripts.
6
+
7
+ ---
8
+
9
+ ## ๐Ÿš€ Installation
10
+
11
+ ```ruby
12
+ gem 'cprl'
13
+ ```
14
+
15
+ Or from local path:
16
+
17
+ ```ruby
18
+ gem 'cprl', path: '/path/to/cprl'
19
+ ```
20
+
21
+ ---
22
+
23
+ ## ๐Ÿ’ก Usage
24
+
25
+ ```ruby
26
+ cprl.info("โ„น๏ธ Informational")
27
+ cprl.ok("โœ… Success")
28
+ cprl.error("โŒ Something went wrong")
29
+ cprl.sql("๐Ÿ˜ Executing SQL")
30
+ ```
31
+
32
+ Works in:
33
+ - Rails controllers
34
+ - Models
35
+ - Views
36
+ - Rails console
37
+ - Standalone scripts
38
+
39
+ ---
40
+
41
+ ## ๐Ÿ› ๏ธ Configuration
42
+
43
+ ```ruby
44
+ Cprl.timestamps = true # Adds timestamp to messages
45
+ Cprl.silent = false # Disable console output
46
+ Cprl.colors = true # Enable/disable ANSI colors
47
+ Cprl.log_to_file = true # Enable file logging
48
+ Cprl.log_file_path = "log/cprl.log"
49
+ ```
50
+
51
+ ---
52
+
53
+ ## ๐Ÿ“œ License
54
+
55
+ MIT
56
+
57
+ ---
58
+
59
+ ## โœ Author
60
+
61
+ **Govani Sรกnchez Orduรฑa**
@@ -0,0 +1,10 @@
1
+ module Cprl
2
+ module Global
3
+ def cprl
4
+ ::Cprl
5
+ end
6
+ end
7
+ end
8
+
9
+ # Inyecta el mรฉtodo en el entorno global
10
+ Object.include(Cprl::Global)
@@ -0,0 +1,7 @@
1
+ module Cprl
2
+ module ModelHelper
3
+ def cprl
4
+ ::Cprl
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails/railtie'
2
+
3
+ module Cprl
4
+ class Railtie < ::Rails::Railtie
5
+ initializer "cprl.configure_rails_initialization" do
6
+ ActiveSupport.on_load(:action_controller) do
7
+ helper_method :cprl if respond_to?(:helper_method)
8
+ end
9
+
10
+ ActiveSupport.on_load(:action_view) do
11
+ include Cprl::ViewHelper
12
+ end
13
+
14
+ ActiveSupport.on_load(:active_record) do
15
+ include Cprl::ModelHelper
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Cprl
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,7 @@
1
+ module Cprl
2
+ module ViewHelper
3
+ def cprl
4
+ ::Cprl
5
+ end
6
+ end
7
+ end
data/lib/cprl.rb ADDED
@@ -0,0 +1,41 @@
1
+ require_relative "cprl/version"
2
+ require_relative "cprl/global"
3
+ module Cprl
4
+ COLORS = {
5
+ info: ["\e[34m", "โ„น๏ธ "],
6
+ warn: ["\e[33m", "โš ๏ธ "],
7
+ error: ["\e[31m", "โŒ "],
8
+ alert: ["\e[35m", "๐Ÿšจ "],
9
+ ok: ["\e[32m", "โœ… "],
10
+ sql: ["\e[36m", "๐Ÿ˜ "],
11
+ debug: ["\e[90m", "๐Ÿž "],
12
+ auth: ["\e[95m", "๐Ÿ” "],
13
+ api: ["\e[96m", "๐ŸŒ "],
14
+ event: ["\e[94m", "๐Ÿ“Œ "],
15
+ file: ["\e[93m", "๐Ÿ“ "],
16
+ network: ["\e[92m", "๐Ÿ“ก "],
17
+ cache: ["\e[37m", "๐Ÿ“ฆ "],
18
+ job: ["\e[96m", "๐Ÿ› ๏ธ "],
19
+ mail: ["\e[91m", "๐Ÿ“ง "],
20
+ config:["\e[94m", "โš™๏ธ "],
21
+ queue: ["\e[90m", "๐Ÿ“ฌ "],
22
+ metric:["\e[92m", "๐Ÿ“ˆ "],
23
+ trace: ["\e[95m", "๐Ÿงต "],
24
+ default: ["\e[0m", ""]
25
+ }
26
+
27
+
28
+
29
+ class << self
30
+ COLORS.each_key do |level|
31
+ define_method(level) do |msg|
32
+ color, emoji = COLORS[level]
33
+ puts "#{color}#{emoji} #{msg}\e[0m"
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ require_relative "cprl/view_helper"
40
+ require_relative "cprl/model_helper"
41
+ require_relative "cprl/railtie" if defined?(Rails)
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cprl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Govani Sรกnchez Orduรฑa
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rails
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '5.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '5.0'
26
+ description: Emoji-colored logger for Ruby and Rails โ€” use it in models, controllers,
27
+ views, console, or scripts.
28
+ email:
29
+ - govani@liz.mx
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/cprl.rb
36
+ - lib/cprl/global.rb
37
+ - lib/cprl/model_helper.rb
38
+ - lib/cprl/railtie.rb
39
+ - lib/cprl/version.rb
40
+ - lib/cprl/view_helper.rb
41
+ homepage: https://rubygems.org/gems/cprl
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.6.9
60
+ specification_version: 4
61
+ summary: Console Print with Rich Logs
62
+ test_files: []