logger 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/push_gem.yml +46 -0
- data/.github/workflows/test.yml +32 -0
- data/.gitignore +11 -0
- data/Gemfile +10 -0
- data/README.md +104 -0
- data/Rakefile +30 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/logger/log_device.rb +6 -1
- data/lib/logger/version.rb +1 -1
- data/logger.gemspec +7 -1
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46ba87e952de11303f4d8a1801c62441825513ed53de7ab20ec75d21b9524cdb
|
4
|
+
data.tar.gz: 985b136ab6b4027a0c28b8980374fc3beed8f3df3b31ee02fe57c0de5ab3cb56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3cb3e144eab09fddc21017774faa4b4f4260ddba3bc8d1b0244654c3c2bf13e610debfd3cef36e9bb83b31379dc5853384accadb586f3415deb090ac0fc1fdb
|
7
|
+
data.tar.gz: 82b5a284490100bee206a12e7030e3fb6287aca0ce8196e7ccc0673445b9b713df77438514b36f2e711523d5e2d1bdb897b83811ea752b3bbe26940efacee0eb
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: Publish gem to rubygems.org
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: read
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
push:
|
13
|
+
if: github.repository == 'ruby/logger'
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
environment:
|
17
|
+
name: rubygems.org
|
18
|
+
url: https://rubygems.org/gems/logger
|
19
|
+
|
20
|
+
permissions:
|
21
|
+
contents: write
|
22
|
+
id-token: write
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- name: Harden Runner
|
26
|
+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
27
|
+
with:
|
28
|
+
egress-policy: audit
|
29
|
+
|
30
|
+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
31
|
+
|
32
|
+
- name: Set up Ruby
|
33
|
+
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
|
34
|
+
with:
|
35
|
+
bundler-cache: true
|
36
|
+
ruby-version: ruby
|
37
|
+
|
38
|
+
- name: Publish to RubyGems
|
39
|
+
uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
|
40
|
+
|
41
|
+
- name: Create GitHub release
|
42
|
+
run: |
|
43
|
+
tag_name="$(git describe --tags --abbrev=0)"
|
44
|
+
gh release create "${tag_name}" --verify-tag --generate-notes
|
45
|
+
env:
|
46
|
+
GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
ruby-versions:
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
+
with:
|
9
|
+
engine: cruby
|
10
|
+
min_version: 2.5
|
11
|
+
|
12
|
+
test:
|
13
|
+
needs: ruby-versions
|
14
|
+
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
18
|
+
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
19
|
+
exclude:
|
20
|
+
- ruby: 2.5
|
21
|
+
os: macos-latest
|
22
|
+
runs-on: ${{ matrix.os }}
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v4
|
25
|
+
- name: Set up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
29
|
+
- name: Install dependencies
|
30
|
+
run: bundle install
|
31
|
+
- name: Run test
|
32
|
+
run: rake test
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# Logger
|
2
|
+
|
3
|
+
Logger is a simple but powerful logging utility to output messages in your Ruby program.
|
4
|
+
|
5
|
+
Logger has the following features:
|
6
|
+
|
7
|
+
* Print messages to different levels such as `info` and `error`
|
8
|
+
* Auto-rolling of log files
|
9
|
+
* Setting the format of log messages
|
10
|
+
* Specifying a program name in conjunction with the message
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'logger'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install logger
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
### Simple Example
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'logger'
|
34
|
+
|
35
|
+
# Create a Logger that prints to STDOUT
|
36
|
+
log = Logger.new(STDOUT)
|
37
|
+
log.debug("Created Logger")
|
38
|
+
|
39
|
+
log.info("Program finished")
|
40
|
+
|
41
|
+
# Create a Logger that prints to STDERR
|
42
|
+
error_log = Logger.new(STDERR)
|
43
|
+
error_log = error_log.error("fatal error")
|
44
|
+
```
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run the following to install dependencies.
|
49
|
+
|
50
|
+
```
|
51
|
+
$ bin/setup
|
52
|
+
```
|
53
|
+
|
54
|
+
Then, run the tests as:
|
55
|
+
|
56
|
+
```
|
57
|
+
$ rake test
|
58
|
+
```
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run
|
61
|
+
|
62
|
+
```
|
63
|
+
$ rake install
|
64
|
+
```
|
65
|
+
|
66
|
+
To release a new version, update the version number in `lib/logger/version.rb`, and then run
|
67
|
+
|
68
|
+
```
|
69
|
+
$ rake release
|
70
|
+
```
|
71
|
+
|
72
|
+
which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
73
|
+
|
74
|
+
## Advanced Development
|
75
|
+
|
76
|
+
### Run tests of a specific file
|
77
|
+
|
78
|
+
```
|
79
|
+
$ ruby test/logger/test_logger.rb
|
80
|
+
```
|
81
|
+
|
82
|
+
### Run tests filtering test methods by a name
|
83
|
+
|
84
|
+
`--name` option is available as:
|
85
|
+
|
86
|
+
```
|
87
|
+
$ ruby test/logger/test_logger.rb --name test_lshift
|
88
|
+
```
|
89
|
+
|
90
|
+
### Publish documents to GitHub Pages
|
91
|
+
|
92
|
+
```
|
93
|
+
$ rake gh-pages
|
94
|
+
```
|
95
|
+
|
96
|
+
Then, git commit and push the generated HTMLs onto `gh-pages` branch.
|
97
|
+
|
98
|
+
## Contributing
|
99
|
+
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/logger.
|
101
|
+
|
102
|
+
## License
|
103
|
+
|
104
|
+
The gem is available as open source under the terms of the [BSD-2-Clause](BSDL).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
begin
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
require "rake/testtask"
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "test/lib"
|
9
|
+
t.ruby_opts << "-rhelper"
|
10
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
require "rdoc/task"
|
14
|
+
RDoc::Task.new do |doc|
|
15
|
+
doc.main = "README.md"
|
16
|
+
doc.title = "Logger -- Ruby Standard Logger"
|
17
|
+
doc.rdoc_files = FileList.new %w[README.md lib BSDL COPYING]
|
18
|
+
doc.rdoc_dir = "html"
|
19
|
+
end
|
20
|
+
|
21
|
+
task "gh-pages" => :rdoc do
|
22
|
+
%x[git checkout gh-pages]
|
23
|
+
require "fileutils"
|
24
|
+
FileUtils.rm_rf "/tmp/html"
|
25
|
+
FileUtils.mv "html", "/tmp"
|
26
|
+
FileUtils.rm_rf "*"
|
27
|
+
FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
|
28
|
+
end
|
29
|
+
|
30
|
+
task :default => :test
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "logger"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/logger/log_device.rb
CHANGED
@@ -70,7 +70,12 @@ class Logger
|
|
70
70
|
# :stopdoc:
|
71
71
|
|
72
72
|
MODE = File::WRONLY | File::APPEND
|
73
|
-
|
73
|
+
# temporary workaround for TruffleRuby
|
74
|
+
if File.const_defined? :SHARE_DELETE
|
75
|
+
MODE_TO_OPEN = MODE | File::SHARE_DELETE | File::BINARY
|
76
|
+
else
|
77
|
+
MODE_TO_OPEN = MODE | File::BINARY
|
78
|
+
end
|
74
79
|
MODE_TO_CREATE = MODE_TO_OPEN | File::CREAT | File::EXCL
|
75
80
|
|
76
81
|
def set_dev(log)
|
data/lib/logger/version.rb
CHANGED
data/logger.gemspec
CHANGED
@@ -15,8 +15,14 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = "https://github.com/ruby/logger"
|
16
16
|
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
17
17
|
|
18
|
-
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
19
23
|
spec.require_paths = ["lib"]
|
20
24
|
|
21
25
|
spec.required_ruby_version = ">= 2.5.0"
|
26
|
+
|
27
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/releases"
|
22
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Provides a simple logging utility for outputting messages.
|
15
15
|
email:
|
@@ -19,8 +19,17 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- ".github/dependabot.yml"
|
23
|
+
- ".github/workflows/push_gem.yml"
|
24
|
+
- ".github/workflows/test.yml"
|
25
|
+
- ".gitignore"
|
22
26
|
- BSDL
|
23
27
|
- COPYING
|
28
|
+
- Gemfile
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- bin/console
|
32
|
+
- bin/setup
|
24
33
|
- lib/logger.rb
|
25
34
|
- lib/logger/errors.rb
|
26
35
|
- lib/logger/formatter.rb
|
@@ -33,7 +42,8 @@ homepage: https://github.com/ruby/logger
|
|
33
42
|
licenses:
|
34
43
|
- Ruby
|
35
44
|
- BSD-2-Clause
|
36
|
-
metadata:
|
45
|
+
metadata:
|
46
|
+
changelog_uri: https://github.com/ruby/logger/releases
|
37
47
|
post_install_message:
|
38
48
|
rdoc_options: []
|
39
49
|
require_paths:
|