logger_easy 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -3
- data/lib/logger_easy/version.rb +5 -0
- data/lib/logger_easy.rb +30 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc25bdbb82b074639ac48267a21cebdd02e45743c243de93d6f66f88c8aa146e
|
4
|
+
data.tar.gz: c7bee45b91bd0cdc36b6522ef9251aef45712ac20cdcb259a4c99ed9a14ec57e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48d08904552ff588f01cfd9b58b41f6923a16e7bdb2f85a81e456313f9b1f71fe57480034f283df83ce234a1ece184f8eb610a14e9d2a610779263ce42e77c22
|
7
|
+
data.tar.gz: 1360bf87c94471e1fda5dbfbb5b13feab3d6bccc214046ebe162b56caf705110a4257cefc602047d53735eee796a70470965a5a9dad68184c0d4d1fa2131ec63
|
data/Gemfile
ADDED
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
|
-
|
11
|
+
<br>
|
4
12
|
|
5
|
-
|
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
|
-
|
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
|
|
data/lib/logger_easy.rb
ADDED
@@ -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.
|
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/
|
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/
|
86
|
+
summary: LoggerEasy provides you a way to easily log your activity. https://bit.ly/logger_easy
|
83
87
|
test_files: []
|