sr_log 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +10 -11
- data/lib/sr_log/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5db7707c0a77a5d4bac7ed154ebd05f6bd1983df
|
4
|
+
data.tar.gz: 4f7060824e0dd840c9e9f2d0e8bb5c589c27be41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b8f8e4dadbfc0b5908e8f601ffc8dd179c1e6bb9c66300014d20f009f9fc8ec6fd2c6c95c9a750e6fed77ffffc1e9881bf4aa86d0f3358c498baffd9934cc61
|
7
|
+
data.tar.gz: 72fb5b9b1bd642f38dde09c3f344a455cfb870a9bfd0daa7f59ab13bbf6a3514a177e6d81dd37a6b9aace7d6b625893e9716dc033ff8013250b8c3e7c70bbe1a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# sr_log
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
**sr_log** is a simple wrapper method around ruby's native `Logger` class. It allows you to write to multiple custom logfiles and serves the purpose of log rotation by prefixing the logfiles with a month stamp.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,20 +20,21 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
To write to a logfile, call the global `sr_log` method. For example:
|
26
24
|
|
27
|
-
|
25
|
+
```ruby
|
26
|
+
sr_log :user_updates, "This is my message"
|
27
|
+
```
|
28
28
|
|
29
|
-
|
29
|
+
`sr_log` will create a `./log/2016_12_user_updates.log` file if one does not already exist (except that it will use current year/month for the prefix). Then it will write the line "This is my message" to the logfile after a timestamp.
|
30
30
|
|
31
|
-
|
31
|
+
Optionally you can pass named arguments to the `sr_log` method:
|
32
32
|
|
33
|
-
|
33
|
+
Argument: `:dir`, type: `string`. Use `:dir` to set a custom path for where the logfile is saved.
|
34
34
|
|
35
|
-
|
35
|
+
Argument: `:current_user`, type: `Object`. Use `:current_user` to specify that the message is being logged by a use. This will add a `"Logged by user: #{current_user}"` line after the timestamp in the logfile.
|
36
36
|
|
37
37
|
|
38
38
|
## License
|
39
39
|
|
40
40
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/sr_log/version.rb
CHANGED