logger_easy 0.1.0 → 0.3.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 +4 -4
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -3
- data/lib/logger_easy/version.rb +5 -0
- data/lib/logger_easy.rb +30 -0
- metadata +8 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23558f99d926efd28695cec63a558383c5992a0bb0e1e095104869fac6994c28
|
4
|
+
data.tar.gz: bc67366d7e0be23f4d800a9b3557ec87e8ab58238f79a92330843df7e2f07afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 542762ce4b7e76c6c74b2cb9ecf8e765342f74381cabff3afdd789aa2d79eb7bfd4aa4ac4c9678fd95c1613ccee24d2dd2633d5ce540016fa06ad7bc031522e2
|
7
|
+
data.tar.gz: 8eaf8e3eadef073df003e63240a1d616f14cc30d4f425bde3b7e818afe61416f7baecd77dce87cbbc06bd8c7dc97c0bc1186bcaaaa4491a8333ff165ed088579
|
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,43 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
24
|
|
17
25
|
## Usage
|
18
26
|
|
19
|
-
|
27
|
+
`include LoggerEasy`
|
28
|
+
|
29
|
+
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
|
30
|
+
```ruby
|
31
|
+
# below method will initialize logger
|
32
|
+
def logger_easy(log_file_name = 'logger_easy.log')
|
33
|
+
@log_file_name = log_file_name
|
34
|
+
@logger = Logger.new(log_file_name)
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Log info in file
|
39
|
+
```ruby
|
40
|
+
# below method will add log info to file
|
41
|
+
def log_info(message)
|
42
|
+
@logger ||= Logger.new(@log_file_name)
|
43
|
+
@logger.info(message)
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Log debug in file
|
48
|
+
```ruby
|
49
|
+
# below method will add debug info to file
|
50
|
+
def log_debug(message)
|
51
|
+
@logger ||= Logger.new(@log_file_name)
|
52
|
+
@logger.debug(message)
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
Log error in file
|
57
|
+
```ruby
|
58
|
+
# below method will add error info to file
|
59
|
+
def log_error(message)
|
60
|
+
@logger ||= Logger.new(@log_file_name)
|
61
|
+
@logger.error(message)
|
62
|
+
end
|
63
|
+
```
|
20
64
|
|
21
65
|
## Development
|
22
66
|
|
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 logger_easy(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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- amit-singh-bisht
|
@@ -9,42 +9,8 @@ autorequire:
|
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-11-20 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: logger
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.5'
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.5.1
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.5'
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.5.1
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rubocop
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.21'
|
40
|
-
type: :runtime
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '1.21'
|
47
|
-
description: LoggerEasy provides you a way to easily log your activity. https://bit.ly/ld_doc
|
12
|
+
dependencies: []
|
13
|
+
description: LoggerEasy provides you a way to easily log your activity. https://bit.ly/logger_easy
|
48
14
|
email:
|
49
15
|
- bishtamitsingh98@gmail.com
|
50
16
|
executables: []
|
@@ -52,7 +18,11 @@ extensions: []
|
|
52
18
|
extra_rdoc_files: []
|
53
19
|
files:
|
54
20
|
- ".rubocop.yml"
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE.txt
|
55
23
|
- README.md
|
24
|
+
- lib/logger_easy.rb
|
25
|
+
- lib/logger_easy/version.rb
|
56
26
|
homepage: https://github.com/amit-singh-bisht/logger_easy_ruby
|
57
27
|
licenses:
|
58
28
|
- MIT
|
@@ -79,5 +49,5 @@ requirements: []
|
|
79
49
|
rubygems_version: 3.2.3
|
80
50
|
signing_key:
|
81
51
|
specification_version: 4
|
82
|
-
summary: LoggerEasy provides you a way to easily log your activity. https://bit.ly/
|
52
|
+
summary: LoggerEasy provides you a way to easily log your activity. https://bit.ly/logger_easy
|
83
53
|
test_files: []
|