logger_easy 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5ebf5a841fdd5736e003089251a7680e343d4a2b383a4eb4e41958d8256bbff
4
- data.tar.gz: f8e5f7c945282285fcb14b0fb6e1922fc3a542dc93bf1d3095bf100bf51858b2
3
+ metadata.gz: bc25bdbb82b074639ac48267a21cebdd02e45743c243de93d6f66f88c8aa146e
4
+ data.tar.gz: c7bee45b91bd0cdc36b6522ef9251aef45712ac20cdcb259a4c99ed9a14ec57e
5
5
  SHA512:
6
- metadata.gz: 68150925722c5178ffa3b68459e4e3b5d7ad910525854b83296abf9aaf791d80dce1833c264e91b8e7752840697c0710a5bd5a7998f50220528e852c82d40e28
7
- data.tar.gz: f145a3cc422b632c91c650a59c7d905f2ca317212acd885e05e26108cf401ef022a1b67b802b13026f4fc32208ba400e49b23519007d9575e9d6ab7049c0c5c5
6
+ metadata.gz: 48d08904552ff588f01cfd9b58b41f6923a16e7bdb2f85a81e456313f9b1f71fe57480034f283df83ce234a1ece184f8eb610a14e9d2a610779263ce42e77c22
7
+ data.tar.gz: 1360bf87c94471e1fda5dbfbb5b13feab3d6bccc214046ebe162b56caf705110a4257cefc602047d53735eee796a70470965a5a9dad68184c0d4d1fa2131ec63
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in logger_easy.gemspec
6
+ gemspec
7
+
8
+ gem 'logger', '~> 1.5', '>= 1.5.1'
9
+ gem 'rubocop', '~> 1.21'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Amit Singh Bisht (https://github.com/amit-singh-bisht)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # LoggerEasy
2
+ <div>
3
+ <a href="https://rubygems.org/gems/logger_easy">
4
+ <img alt="GEM Version" src="https://img.shields.io/gem/v/logger_easy?color=38C160&logo=ruby&logoColor=FE1616">
5
+ </a>
6
+ <a href="https://rubygems.org/gems/logger_easy">
7
+ <img alt="Gem Downloads" src="https://img.shields.io/gem/dt/logger_easy?color=38C160&logo=ruby&logoColor=FE1616">
8
+ </a>
9
+ </div>
2
10
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/logger_easy`. To experiment with that code, run `bin/console` for an interactive prompt.
11
+ <br>
4
12
 
5
- TODO: Delete this and the text above, and describe your gem
13
+ LoggerEasy provides you a way to easily log your activity
6
14
 
7
15
  ## Installation
8
16
 
@@ -16,7 +24,37 @@ If bundler is not being used to manage dependencies, install the gem by executin
16
24
 
17
25
  ## Usage
18
26
 
19
- TODO: Write usage instructions here
27
+ Initialize the module by passing a file name where you want the logs to be appended, if no file_name is passed in parameter, it will create a file with name as `logger_easy.log` in the current working directory
28
+ ```ruby
29
+ def initialize(log_file_name = 'logger_easy.log')
30
+ @log_file_name = log_file_name
31
+ @logger = Logger.new(log_file_name)
32
+ end
33
+ ```
34
+
35
+ Log info in file
36
+ ```ruby
37
+ def log_info(message)
38
+ @logger ||= Logger.new(@log_file_name)
39
+ @logger.info(message)
40
+ end
41
+ ```
42
+
43
+ Log debug in file
44
+ ```ruby
45
+ def log_debug(message)
46
+ @logger ||= Logger.new(@log_file_name)
47
+ @logger.debug(message)
48
+ end
49
+ ```
50
+
51
+ Log error in file
52
+ ```ruby
53
+ def log_error(message)
54
+ @logger ||= Logger.new(@log_file_name)
55
+ @logger.error(message)
56
+ end
57
+ ```
20
58
 
21
59
  ## Development
22
60
 
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggerEasy
4
+ VERSION = '0.2.0'
5
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+
5
+ # below is the code to make life easier as it already has logging methods defined
6
+ module LoggerEasy
7
+
8
+ attr_accessor :log_file_name
9
+
10
+ def initialize(log_file_name = 'logger_easy.log')
11
+ @log_file_name = log_file_name
12
+ @logger = Logger.new(log_file_name)
13
+ end
14
+
15
+ def log_info(message)
16
+ @logger ||= Logger.new(@log_file_name)
17
+ @logger.info(message)
18
+ end
19
+
20
+ def log_debug(message)
21
+ @logger ||= Logger.new(@log_file_name)
22
+ @logger.debug(message)
23
+ end
24
+
25
+ def log_error(message)
26
+ @logger ||= Logger.new(@log_file_name)
27
+ @logger.error(message)
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logger_easy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - amit-singh-bisht
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.21'
47
- description: LoggerEasy provides you a way to easily log your activity. https://bit.ly/ld_doc
47
+ description: LoggerEasy provides you a way to easily log your activity. https://bit.ly/logger_easy
48
48
  email:
49
49
  - bishtamitsingh98@gmail.com
50
50
  executables: []
@@ -52,7 +52,11 @@ extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
54
  - ".rubocop.yml"
55
+ - Gemfile
56
+ - LICENSE.txt
55
57
  - README.md
58
+ - lib/logger_easy.rb
59
+ - lib/logger_easy/version.rb
56
60
  homepage: https://github.com/amit-singh-bisht/logger_easy_ruby
57
61
  licenses:
58
62
  - MIT
@@ -79,5 +83,5 @@ requirements: []
79
83
  rubygems_version: 3.2.3
80
84
  signing_key:
81
85
  specification_version: 4
82
- summary: LoggerEasy provides you a way to easily log your activity. https://bit.ly/ld_doc
86
+ summary: LoggerEasy provides you a way to easily log your activity. https://bit.ly/logger_easy
83
87
  test_files: []