loog 0.6.0 → 0.7.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 +12 -25
- data/Gemfile.lock +108 -0
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +26 -4
- data/REUSE.toml +36 -0
- data/Rakefile +3 -21
- data/lib/loog/ellipsized.rb +59 -0
- data/lib/loog/tee.rb +12 -26
- data/lib/loog.rb +10 -26
- data/logo.svg +1 -1
- data/loog.gemspec +7 -24
- metadata +37 -26
- data/.0pdd.yml +0 -29
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -41
- data/.github/workflows/codecov.yml +0 -38
- data/.github/workflows/copyrights.yml +0 -30
- data/.github/workflows/markdown-lint.yml +0 -38
- data/.github/workflows/pdd.yml +0 -34
- data/.github/workflows/rake.yml +0 -43
- data/.github/workflows/xcop.yml +0 -36
- data/.gitignore +0 -6
- data/.pdd +0 -5
- data/.rubocop.yml +0 -44
- data/.rultor.yml +0 -40
- data/.simplecov +0 -40
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -28
- data/test/test_loog.rb +0 -68
- data/test/test_tee.rb +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfd382c687b56de8264decc871bf4edd67c3dd0bc34af6072dbeeffd6b4fa5b9
|
|
4
|
+
data.tar.gz: 0b5610e54655500cdafc1f2a9dbb14e13988f5b9cca21ac15b12c2775ca39c0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59f9e40500c00a7e9d932b4d12e8f78d23f4f9f68db78472f6e18a96256d1d57044891f3333dca5554f5925ecd8490f7f6e33cb066b21455c6cd9fdb12b1ca5b
|
|
7
|
+
data.tar.gz: 22a8e7b63133b3acfeaf2265b2a782cfc376617c3471ba3674c281b52c46f39b49dd0072b46e62d862c5c90f500e8985bf51e26a28bd1e6b537d5d82bd70922f
|
data/Gemfile
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
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 all
|
|
13
|
-
# 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 THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
source 'https://rubygems.org'
|
|
24
7
|
gemspec
|
|
25
8
|
|
|
26
|
-
gem 'minitest', '
|
|
27
|
-
gem '
|
|
28
|
-
gem '
|
|
29
|
-
gem '
|
|
30
|
-
gem 'rubocop
|
|
31
|
-
gem '
|
|
9
|
+
gem 'minitest', '~>6.0', require: false
|
|
10
|
+
gem 'minitest-reporters', '~>1.7', require: false
|
|
11
|
+
gem 'rake', '~>13.2', require: false
|
|
12
|
+
gem 'rdoc', '~>7.0', require: false
|
|
13
|
+
gem 'rubocop', '~>1.71', require: false
|
|
14
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
|
15
|
+
gem 'rubocop-performance', '~>1.25', require: false
|
|
16
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
|
17
|
+
gem 'simplecov', '~>0.22', require: false
|
|
18
|
+
gem 'simplecov-cobertura', '~>3.0', require: false
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
loog (0.0.0)
|
|
5
|
+
ellipsized
|
|
6
|
+
logger (~> 1.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
ansi (1.5.0)
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
builder (3.3.0)
|
|
14
|
+
date (3.5.1)
|
|
15
|
+
docile (1.4.1)
|
|
16
|
+
ellipsized (0.3.0)
|
|
17
|
+
erb (6.0.1)
|
|
18
|
+
json (2.18.0)
|
|
19
|
+
language_server-protocol (3.17.0.5)
|
|
20
|
+
lint_roller (1.1.0)
|
|
21
|
+
logger (1.7.0)
|
|
22
|
+
minitest (6.0.1)
|
|
23
|
+
prism (~> 1.5)
|
|
24
|
+
minitest-reporters (1.7.1)
|
|
25
|
+
ansi
|
|
26
|
+
builder
|
|
27
|
+
minitest (>= 5.0)
|
|
28
|
+
ruby-progressbar
|
|
29
|
+
parallel (1.27.0)
|
|
30
|
+
parser (3.3.10.1)
|
|
31
|
+
ast (~> 2.4.1)
|
|
32
|
+
racc
|
|
33
|
+
prism (1.8.0)
|
|
34
|
+
psych (5.3.1)
|
|
35
|
+
date
|
|
36
|
+
stringio
|
|
37
|
+
racc (1.8.1)
|
|
38
|
+
rainbow (3.1.1)
|
|
39
|
+
rake (13.3.1)
|
|
40
|
+
rdoc (7.1.0)
|
|
41
|
+
erb
|
|
42
|
+
psych (>= 4.0.0)
|
|
43
|
+
tsort
|
|
44
|
+
regexp_parser (2.11.3)
|
|
45
|
+
rexml (3.4.4)
|
|
46
|
+
rubocop (1.82.1)
|
|
47
|
+
json (~> 2.3)
|
|
48
|
+
language_server-protocol (~> 3.17.0.2)
|
|
49
|
+
lint_roller (~> 1.1.0)
|
|
50
|
+
parallel (~> 1.10)
|
|
51
|
+
parser (>= 3.3.0.2)
|
|
52
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
53
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
54
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
55
|
+
ruby-progressbar (~> 1.7)
|
|
56
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
57
|
+
rubocop-ast (1.49.0)
|
|
58
|
+
parser (>= 3.3.7.2)
|
|
59
|
+
prism (~> 1.7)
|
|
60
|
+
rubocop-minitest (0.38.2)
|
|
61
|
+
lint_roller (~> 1.1)
|
|
62
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
63
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
64
|
+
rubocop-performance (1.26.1)
|
|
65
|
+
lint_roller (~> 1.1)
|
|
66
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
67
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
68
|
+
rubocop-rake (0.7.1)
|
|
69
|
+
lint_roller (~> 1.1)
|
|
70
|
+
rubocop (>= 1.72.1)
|
|
71
|
+
ruby-progressbar (1.13.0)
|
|
72
|
+
simplecov (0.22.0)
|
|
73
|
+
docile (~> 1.1)
|
|
74
|
+
simplecov-html (~> 0.11)
|
|
75
|
+
simplecov_json_formatter (~> 0.1)
|
|
76
|
+
simplecov-cobertura (3.1.0)
|
|
77
|
+
rexml
|
|
78
|
+
simplecov (~> 0.19)
|
|
79
|
+
simplecov-html (0.13.2)
|
|
80
|
+
simplecov_json_formatter (0.1.4)
|
|
81
|
+
stringio (3.2.0)
|
|
82
|
+
tsort (0.2.0)
|
|
83
|
+
unicode-display_width (3.2.0)
|
|
84
|
+
unicode-emoji (~> 4.1)
|
|
85
|
+
unicode-emoji (4.2.0)
|
|
86
|
+
|
|
87
|
+
PLATFORMS
|
|
88
|
+
arm64-darwin-22
|
|
89
|
+
arm64-darwin-23
|
|
90
|
+
arm64-darwin-24
|
|
91
|
+
x64-mingw-ucrt
|
|
92
|
+
x86_64-linux
|
|
93
|
+
|
|
94
|
+
DEPENDENCIES
|
|
95
|
+
loog!
|
|
96
|
+
minitest (~> 6.0)
|
|
97
|
+
minitest-reporters (~> 1.7)
|
|
98
|
+
rake (~> 13.2)
|
|
99
|
+
rdoc (~> 7.0)
|
|
100
|
+
rubocop (~> 1.71)
|
|
101
|
+
rubocop-minitest (~> 0.38)
|
|
102
|
+
rubocop-performance (~> 1.25)
|
|
103
|
+
rubocop-rake (~> 0.7)
|
|
104
|
+
simplecov (~> 0.22)
|
|
105
|
+
simplecov-cobertura (~> 3.0)
|
|
106
|
+
|
|
107
|
+
BUNDLED WITH
|
|
108
|
+
2.5.16
|
data/LICENSE.txt
CHANGED
data/LICENSES/MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2026 Yegor Bugayenko
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Object-Oriented Logger for Ruby
|
|
2
2
|
|
|
3
3
|
[](https://www.elegantobjects.org)
|
|
4
|
-
[](https://www.rultor.com/p/yegor256/loog)
|
|
5
5
|
[](https://www.jetbrains.com/ruby/)
|
|
6
6
|
|
|
7
7
|
[](https://github.com/yegor256/loog/actions/workflows/rake.yml)
|
|
8
|
-
[](
|
|
8
|
+
[](https://badge.fury.io/rb/loog)
|
|
9
9
|
[](https://codeclimate.com/github/yegor256/loog/maintainability)
|
|
10
|
-
[](https://rubydoc.info/github/yegor256/loog/master/frames)
|
|
11
11
|
[](https://codecov.io/github/yegor256/loog?branch=master)
|
|
12
12
|
[](https://hitsofcode.com/view/github/yegor256/loog)
|
|
13
13
|
|
|
@@ -35,11 +35,33 @@ There is also `Loog::Buffer` class that you can use for testing.
|
|
|
35
35
|
It accumulates all log calls and then returns the entire output
|
|
36
36
|
through the `to_s()` method.
|
|
37
37
|
|
|
38
|
+
Also, you can "tee" two loogs, with the help of `Loog::Tee`. For example,
|
|
39
|
+
to record everything in a buffer and also show in the console:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
require 'loog'
|
|
43
|
+
require 'loog/tee'
|
|
44
|
+
buf = Loog::Buffer.new
|
|
45
|
+
loog = Loog::Tee.new(Loog::VERBOSE, buf)
|
|
46
|
+
loog.info('Hello, world!')
|
|
47
|
+
assert(buf.to_s.include?('Hello'))
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can also truncate long messages with `Loog::Ellipsized`:
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
require 'loog'
|
|
54
|
+
require 'loog/ellipsized'
|
|
55
|
+
loog = Loog::Ellipsized.new(Loog::VERBOSE, 20)
|
|
56
|
+
loog.info('This is a very long message that will be truncated')
|
|
57
|
+
# prints: "This is...truncated"
|
|
58
|
+
```
|
|
59
|
+
|
|
38
60
|
## How to contribute
|
|
39
61
|
|
|
40
62
|
Read
|
|
41
63
|
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
|
42
|
-
Make sure
|
|
64
|
+
Make sure your build is green before you contribute
|
|
43
65
|
your pull request. You will need to have
|
|
44
66
|
[Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
|
45
67
|
[Bundler](https://bundler.io/) installed. Then:
|
data/REUSE.toml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
version = 1
|
|
5
|
+
[[annotations]]
|
|
6
|
+
path = [
|
|
7
|
+
".DS_Store",
|
|
8
|
+
".gitattributes",
|
|
9
|
+
".gitignore",
|
|
10
|
+
".pdd",
|
|
11
|
+
"**.json",
|
|
12
|
+
"**.md",
|
|
13
|
+
"**.png",
|
|
14
|
+
"**.svg",
|
|
15
|
+
"**.txt",
|
|
16
|
+
"**/.DS_Store",
|
|
17
|
+
"**/.gitignore",
|
|
18
|
+
"**/.pdd",
|
|
19
|
+
"**/*.csv",
|
|
20
|
+
"**/*.jpg",
|
|
21
|
+
"**/*.json",
|
|
22
|
+
"**/*.md",
|
|
23
|
+
"**/*.pdf",
|
|
24
|
+
"**/*.png",
|
|
25
|
+
"**/*.svg",
|
|
26
|
+
"**/*.txt",
|
|
27
|
+
"**/*.vm",
|
|
28
|
+
"**/CNAME",
|
|
29
|
+
"**/Gemfile.lock",
|
|
30
|
+
"Gemfile.lock",
|
|
31
|
+
"README.md",
|
|
32
|
+
"renovate.json",
|
|
33
|
+
]
|
|
34
|
+
precedence = "override"
|
|
35
|
+
SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
|
|
36
|
+
SPDX-License-Identifier = "MIT"
|
data/Rakefile
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
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 all
|
|
13
|
-
# 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 THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'rubygems'
|
|
24
7
|
require 'rake'
|
|
25
8
|
require 'rake/clean'
|
|
26
9
|
|
|
27
|
-
CLEAN
|
|
10
|
+
CLEAN.include('coverage')
|
|
28
11
|
|
|
29
12
|
def name
|
|
30
13
|
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
|
@@ -54,5 +37,4 @@ end
|
|
|
54
37
|
require 'rubocop/rake_task'
|
|
55
38
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
56
39
|
task.fail_on_error = true
|
|
57
|
-
task.requires << 'rubocop-rspec'
|
|
58
40
|
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
|
|
6
|
+
require 'ellipsized'
|
|
7
|
+
require_relative '../loog'
|
|
8
|
+
|
|
9
|
+
# Log decorator that makes all lines ellipsized in the middle.
|
|
10
|
+
#
|
|
11
|
+
# require 'loog'
|
|
12
|
+
# require 'loog/ellipsized'
|
|
13
|
+
# tee = Loog::Ellipsized.new(Loog::VERBOSE, 10)
|
|
14
|
+
# tee.info('Hello, world!')
|
|
15
|
+
#
|
|
16
|
+
# Only a part of the message is printed.
|
|
17
|
+
#
|
|
18
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
19
|
+
# Copyright:: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
20
|
+
# License:: MIT
|
|
21
|
+
class Loog::Ellipsized
|
|
22
|
+
# Makes an instance.
|
|
23
|
+
def initialize(log, width = 100)
|
|
24
|
+
@log = log
|
|
25
|
+
@width = width
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def debug(msg)
|
|
29
|
+
@log.debug(msg.ellipsized(@width))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def debug?
|
|
33
|
+
@log.debug?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def info(msg)
|
|
37
|
+
@log.info(msg.ellipsized(@width))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def info?
|
|
41
|
+
@log.info?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def warn(msg)
|
|
45
|
+
@log.warn(msg.ellipsized(@width))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def warn?
|
|
49
|
+
@log.warn?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def error(msg)
|
|
53
|
+
@log.error(msg.ellipsized(@width))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def error?
|
|
57
|
+
@log.error?
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/loog/tee.rb
CHANGED
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# (
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
24
5
|
|
|
25
6
|
require_relative '../loog'
|
|
26
7
|
|
|
27
8
|
# A combiner of a few logs together:
|
|
28
9
|
#
|
|
29
10
|
# require 'loog'
|
|
11
|
+
# require 'loog/tee'
|
|
30
12
|
# tee = Loog::Tee.new(Loog::VERBOSE, file_logger)
|
|
31
|
-
#
|
|
13
|
+
# tee.info('Hello, world!')
|
|
32
14
|
#
|
|
33
15
|
# This way you can log to console and to the file at the same time.
|
|
34
16
|
#
|
|
35
17
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
36
|
-
# Copyright:: Copyright (c) 2018-
|
|
18
|
+
# Copyright:: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
37
19
|
# License:: MIT
|
|
38
20
|
class Loog::Tee
|
|
39
21
|
# Makes an instance.
|
|
@@ -46,7 +28,7 @@ class Loog::Tee
|
|
|
46
28
|
end
|
|
47
29
|
|
|
48
30
|
def debug?
|
|
49
|
-
@logs.any?
|
|
31
|
+
@logs.any?(&:debug?)
|
|
50
32
|
end
|
|
51
33
|
|
|
52
34
|
def info(msg)
|
|
@@ -54,7 +36,7 @@ class Loog::Tee
|
|
|
54
36
|
end
|
|
55
37
|
|
|
56
38
|
def info?
|
|
57
|
-
@logs.any?
|
|
39
|
+
@logs.any?(&:info?)
|
|
58
40
|
end
|
|
59
41
|
|
|
60
42
|
def warn(msg)
|
|
@@ -62,10 +44,14 @@ class Loog::Tee
|
|
|
62
44
|
end
|
|
63
45
|
|
|
64
46
|
def warn?
|
|
65
|
-
@logs.any?
|
|
47
|
+
@logs.any?(&:warn?)
|
|
66
48
|
end
|
|
67
49
|
|
|
68
50
|
def error(msg)
|
|
69
51
|
@logs.each { |g| g.error(msg) }
|
|
70
52
|
end
|
|
53
|
+
|
|
54
|
+
def error?
|
|
55
|
+
@logs.any?(&:error?)
|
|
56
|
+
end
|
|
71
57
|
end
|
data/lib/loog.rb
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# (
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
24
5
|
|
|
25
6
|
require 'logger'
|
|
26
7
|
require 'time'
|
|
@@ -35,7 +16,7 @@ require 'time'
|
|
|
35
16
|
# {README}[https://github.com/yegor256/loog/blob/master/README.md] file.
|
|
36
17
|
#
|
|
37
18
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
38
|
-
# Copyright:: Copyright (c) 2018-
|
|
19
|
+
# Copyright:: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
39
20
|
# License:: MIT
|
|
40
21
|
module Loog
|
|
41
22
|
# Compact formatter
|
|
@@ -47,21 +28,24 @@ module Loog
|
|
|
47
28
|
when 'DEBUG'
|
|
48
29
|
prefix = 'D: '
|
|
49
30
|
end
|
|
50
|
-
|
|
31
|
+
message = msg.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
32
|
+
"#{prefix}#{message.rstrip.gsub("\n", "\n#{' ' * prefix.length}")}\n"
|
|
51
33
|
end
|
|
52
34
|
|
|
53
35
|
# Short formatter
|
|
54
36
|
SHORT = proc do |_severity, _time, _target, msg|
|
|
55
|
-
|
|
37
|
+
message = msg.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
38
|
+
"#{message.rstrip}\n"
|
|
56
39
|
end
|
|
57
40
|
|
|
58
41
|
# Full formatter
|
|
59
42
|
FULL = proc do |severity, time, _target, msg|
|
|
43
|
+
message = msg.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
60
44
|
format(
|
|
61
45
|
"%<time>s %<severity>5s %<msg>s\n",
|
|
62
46
|
time: time.utc.iso8601,
|
|
63
47
|
severity: severity,
|
|
64
|
-
msg:
|
|
48
|
+
msg: message.rstrip
|
|
65
49
|
)
|
|
66
50
|
end
|
|
67
51
|
|
|
@@ -109,7 +93,7 @@ module Loog
|
|
|
109
93
|
end
|
|
110
94
|
|
|
111
95
|
def to_s
|
|
112
|
-
@lines.map { |s| s.dup.
|
|
96
|
+
@lines.map { |s| s.dup.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?') }.join
|
|
113
97
|
end
|
|
114
98
|
end
|
|
115
99
|
end
|
data/logo.svg
CHANGED
data/loog.gemspec
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# (
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2026 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
24
5
|
|
|
25
6
|
require 'English'
|
|
26
7
|
Gem::Specification.new do |s|
|
|
27
8
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
28
9
|
s.required_ruby_version = '>=2.3'
|
|
29
10
|
s.name = 'loog'
|
|
30
|
-
s.version = '0.
|
|
11
|
+
s.version = '0.7.0'
|
|
31
12
|
s.license = 'MIT'
|
|
32
13
|
s.summary = 'Object-oriented logging wrapper'
|
|
33
14
|
s.description = 'Object-oriented wrapper for Ruby default logging facility'
|
|
34
15
|
s.authors = ['Yegor Bugayenko']
|
|
35
16
|
s.email = 'yegor256@gmail.com'
|
|
36
|
-
s.homepage = '
|
|
37
|
-
s.files = `git ls-files`.split($RS)
|
|
17
|
+
s.homepage = 'https://github.com/yegor256/loog'
|
|
18
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
|
38
19
|
s.rdoc_options = ['--charset=UTF-8']
|
|
39
20
|
s.extra_rdoc_files = ['README.md']
|
|
21
|
+
s.add_dependency 'ellipsized'
|
|
22
|
+
s.add_dependency 'logger', '~>1.0'
|
|
40
23
|
s.metadata['rubygems_mfa_required'] = 'true'
|
|
41
24
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: loog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ellipsized
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: logger
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
13
40
|
description: Object-oriented wrapper for Ruby default logging facility
|
|
14
41
|
email: yegor256@gmail.com
|
|
15
42
|
executables: []
|
|
@@ -17,38 +44,23 @@ extensions: []
|
|
|
17
44
|
extra_rdoc_files:
|
|
18
45
|
- README.md
|
|
19
46
|
files:
|
|
20
|
-
- ".0pdd.yml"
|
|
21
|
-
- ".gitattributes"
|
|
22
|
-
- ".github/workflows/actionlint.yml"
|
|
23
|
-
- ".github/workflows/codecov.yml"
|
|
24
|
-
- ".github/workflows/copyrights.yml"
|
|
25
|
-
- ".github/workflows/markdown-lint.yml"
|
|
26
|
-
- ".github/workflows/pdd.yml"
|
|
27
|
-
- ".github/workflows/rake.yml"
|
|
28
|
-
- ".github/workflows/xcop.yml"
|
|
29
|
-
- ".gitignore"
|
|
30
|
-
- ".pdd"
|
|
31
|
-
- ".rubocop.yml"
|
|
32
|
-
- ".rultor.yml"
|
|
33
|
-
- ".simplecov"
|
|
34
47
|
- Gemfile
|
|
48
|
+
- Gemfile.lock
|
|
35
49
|
- LICENSE.txt
|
|
50
|
+
- LICENSES/MIT.txt
|
|
36
51
|
- README.md
|
|
52
|
+
- REUSE.toml
|
|
37
53
|
- Rakefile
|
|
38
54
|
- lib/loog.rb
|
|
55
|
+
- lib/loog/ellipsized.rb
|
|
39
56
|
- lib/loog/tee.rb
|
|
40
57
|
- logo.svg
|
|
41
58
|
- loog.gemspec
|
|
42
|
-
|
|
43
|
-
- test/test__helper.rb
|
|
44
|
-
- test/test_loog.rb
|
|
45
|
-
- test/test_tee.rb
|
|
46
|
-
homepage: http://github.com/yegor256/loog
|
|
59
|
+
homepage: https://github.com/yegor256/loog
|
|
47
60
|
licenses:
|
|
48
61
|
- MIT
|
|
49
62
|
metadata:
|
|
50
63
|
rubygems_mfa_required: 'true'
|
|
51
|
-
post_install_message:
|
|
52
64
|
rdoc_options:
|
|
53
65
|
- "--charset=UTF-8"
|
|
54
66
|
require_paths:
|
|
@@ -64,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
76
|
- !ruby/object:Gem::Version
|
|
65
77
|
version: '0'
|
|
66
78
|
requirements: []
|
|
67
|
-
rubygems_version: 3.
|
|
68
|
-
signing_key:
|
|
79
|
+
rubygems_version: 3.6.9
|
|
69
80
|
specification_version: 4
|
|
70
81
|
summary: Object-oriented logging wrapper
|
|
71
82
|
test_files: []
|
data/.0pdd.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
errors:
|
|
22
|
-
- yegor256@gmail.com
|
|
23
|
-
# alerts:
|
|
24
|
-
# github:
|
|
25
|
-
# - yegor256
|
|
26
|
-
|
|
27
|
-
tags:
|
|
28
|
-
- pdd
|
|
29
|
-
- bug
|
data/.gitattributes
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: actionlint
|
|
22
|
-
'on':
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
pull_request:
|
|
27
|
-
branches:
|
|
28
|
-
- master
|
|
29
|
-
jobs:
|
|
30
|
-
actionlint:
|
|
31
|
-
runs-on: ubuntu-22.04
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v4
|
|
34
|
-
- name: Download actionlint
|
|
35
|
-
id: get_actionlint
|
|
36
|
-
# yamllint disable-line rule:line-length
|
|
37
|
-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
|
38
|
-
shell: bash
|
|
39
|
-
- name: Check workflow files
|
|
40
|
-
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
|
41
|
-
shell: bash
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: codecov
|
|
22
|
-
on:
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
jobs:
|
|
27
|
-
codecov:
|
|
28
|
-
runs-on: ubuntu-22.04
|
|
29
|
-
steps:
|
|
30
|
-
- uses: actions/checkout@v4
|
|
31
|
-
- uses: actions/setup-ruby@v1
|
|
32
|
-
with:
|
|
33
|
-
ruby-version: 3.2
|
|
34
|
-
- run: bundle update
|
|
35
|
-
- run: bundle exec rake
|
|
36
|
-
- uses: codecov/codecov-action@v4.0.0-beta.3
|
|
37
|
-
with:
|
|
38
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: copyrights
|
|
22
|
-
'on':
|
|
23
|
-
push:
|
|
24
|
-
pull_request:
|
|
25
|
-
jobs:
|
|
26
|
-
copyrights:
|
|
27
|
-
runs-on: ubuntu-22.04
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@v4
|
|
30
|
-
- uses: yegor256/copyrights-action@0.0.5
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: markdown-lint
|
|
22
|
-
'on':
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
pull_request:
|
|
27
|
-
branches:
|
|
28
|
-
- master
|
|
29
|
-
paths-ignore: ['paper/**', 'sandbox/**']
|
|
30
|
-
concurrency:
|
|
31
|
-
group: markdown-lint-${{ github.ref }}
|
|
32
|
-
cancel-in-progress: true
|
|
33
|
-
jobs:
|
|
34
|
-
markdown-lint:
|
|
35
|
-
runs-on: ubuntu-22.04
|
|
36
|
-
steps:
|
|
37
|
-
- uses: actions/checkout@v4
|
|
38
|
-
- uses: articulate/actions-markdownlint@v1
|
data/.github/workflows/pdd.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: pdd
|
|
22
|
-
on:
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
pull_request:
|
|
27
|
-
branches:
|
|
28
|
-
- master
|
|
29
|
-
jobs:
|
|
30
|
-
pdd:
|
|
31
|
-
runs-on: ubuntu-22.04
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v4
|
|
34
|
-
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: rake
|
|
22
|
-
on:
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
pull_request:
|
|
27
|
-
branches:
|
|
28
|
-
- master
|
|
29
|
-
jobs:
|
|
30
|
-
test:
|
|
31
|
-
name: test
|
|
32
|
-
strategy:
|
|
33
|
-
matrix:
|
|
34
|
-
os: [ubuntu-22.04]
|
|
35
|
-
ruby: [3.2]
|
|
36
|
-
runs-on: ${{ matrix.os }}
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v4
|
|
39
|
-
- uses: ruby/setup-ruby@v1
|
|
40
|
-
with:
|
|
41
|
-
ruby-version: ${{ matrix.ruby }}
|
|
42
|
-
- run: bundle update
|
|
43
|
-
- run: bundle exec rake
|
data/.github/workflows/xcop.yml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
name: xcop
|
|
22
|
-
"on":
|
|
23
|
-
push:
|
|
24
|
-
branches:
|
|
25
|
-
- master
|
|
26
|
-
pull_request:
|
|
27
|
-
branches:
|
|
28
|
-
- master
|
|
29
|
-
jobs:
|
|
30
|
-
xcop:
|
|
31
|
-
runs-on: ubuntu-22.04
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v4
|
|
34
|
-
- uses: g4s8/xcop-action@master
|
|
35
|
-
with:
|
|
36
|
-
files: '**/*.xml'
|
data/.gitignore
DELETED
data/.pdd
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
AllCops:
|
|
22
|
-
DisplayCopNames: true
|
|
23
|
-
TargetRubyVersion: 2.3.3
|
|
24
|
-
SuggestExtensions: false
|
|
25
|
-
NewCops: enable
|
|
26
|
-
|
|
27
|
-
Layout/EmptyLineAfterGuardClause:
|
|
28
|
-
Enabled: false
|
|
29
|
-
Layout/MultilineMethodCallIndentation:
|
|
30
|
-
Enabled: false
|
|
31
|
-
Metrics/AbcSize:
|
|
32
|
-
Max: 50
|
|
33
|
-
Metrics/MethodLength:
|
|
34
|
-
Max: 30
|
|
35
|
-
Metrics/CyclomaticComplexity:
|
|
36
|
-
Max: 10
|
|
37
|
-
Metrics/PerceivedComplexity:
|
|
38
|
-
Max: 10
|
|
39
|
-
Metrics/ParameterLists:
|
|
40
|
-
Max: 10
|
|
41
|
-
Layout/ParameterAlignment:
|
|
42
|
-
Enabled: false
|
|
43
|
-
Style/ClassAndModuleChildren:
|
|
44
|
-
Enabled: false
|
data/.rultor.yml
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
# copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
# SOFTWARE.
|
|
20
|
-
---
|
|
21
|
-
docker:
|
|
22
|
-
image: yegor256/rultor-image:1.23.1
|
|
23
|
-
assets:
|
|
24
|
-
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
25
|
-
install: |
|
|
26
|
-
pdd -f /dev/null
|
|
27
|
-
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
|
28
|
-
release:
|
|
29
|
-
script: |-
|
|
30
|
-
bundle exec rake
|
|
31
|
-
rm -rf *.gem
|
|
32
|
-
sed -i "s/0\.0\.0/${tag}/g" loog.gemspec
|
|
33
|
-
git add loog.gemspec
|
|
34
|
-
git commit -m "version set to ${tag}"
|
|
35
|
-
gem build loog.gemspec
|
|
36
|
-
chmod 0600 ../rubygems.yml
|
|
37
|
-
gem push *.gem --config-file ../rubygems.yml
|
|
38
|
-
merge:
|
|
39
|
-
script: |-
|
|
40
|
-
bundle exec rake
|
data/.simplecov
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019 Yegor Bugayenko
|
|
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 all
|
|
13
|
-
# 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 NONINFINGEMENT. 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 THE
|
|
21
|
-
# SOFTWARE.
|
|
22
|
-
|
|
23
|
-
if Gem.win_platform?
|
|
24
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
25
|
-
SimpleCov::Formatter::HTMLFormatter
|
|
26
|
-
]
|
|
27
|
-
SimpleCov.start do
|
|
28
|
-
add_filter '/test/'
|
|
29
|
-
add_filter '/features/'
|
|
30
|
-
end
|
|
31
|
-
else
|
|
32
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
33
|
-
[SimpleCov::Formatter::HTMLFormatter]
|
|
34
|
-
)
|
|
35
|
-
SimpleCov.start do
|
|
36
|
-
add_filter '/test/'
|
|
37
|
-
add_filter '/features/'
|
|
38
|
-
minimum_coverage 60
|
|
39
|
-
end
|
|
40
|
-
end
|
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# (The MIT License)
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
24
|
-
|
|
25
|
-
$stdout.sync = true
|
|
26
|
-
|
|
27
|
-
require 'simplecov'
|
|
28
|
-
SimpleCov.start
|
data/test/test_loog.rb
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# (The MIT License)
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
24
|
-
|
|
25
|
-
require 'minitest/autorun'
|
|
26
|
-
require_relative '../lib/loog'
|
|
27
|
-
|
|
28
|
-
# Loog test.
|
|
29
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
30
|
-
# Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
|
|
31
|
-
# License:: MIT
|
|
32
|
-
class LoogTest < Minitest::Test
|
|
33
|
-
def test_simple_logging
|
|
34
|
-
Loog::VERBOSE.info('Works?')
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def test_null_logging
|
|
38
|
-
Loog::NULL.info('Should not be visible')
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_buffering
|
|
42
|
-
b = Loog::Buffer.new(formatter: Loog::FULL)
|
|
43
|
-
b.debug('Hello, world!')
|
|
44
|
-
b.info('Hello, world!')
|
|
45
|
-
b.warn('Hello, world!')
|
|
46
|
-
b.error('Hello, world!')
|
|
47
|
-
stdout = b.to_s
|
|
48
|
-
assert(stdout.include?('Hello'))
|
|
49
|
-
assert(stdout.include?('DEBUG'))
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_quiet_buffering
|
|
53
|
-
b = Loog::Buffer.new
|
|
54
|
-
b.info('Hey, друг!')
|
|
55
|
-
b.warn('Bye!')
|
|
56
|
-
b.error('+')
|
|
57
|
-
assert_equal("Hey, друг!\nBye!\n+\n", b.to_s)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def test_buffer_non_utf
|
|
61
|
-
b = Loog::Buffer.new
|
|
62
|
-
msg = [0x41, 0x42, 0xC0].pack('c*')
|
|
63
|
-
b.debug('привет')
|
|
64
|
-
b.debug(msg)
|
|
65
|
-
stdout = b.to_s
|
|
66
|
-
assert(stdout.include?('AB'), stdout)
|
|
67
|
-
end
|
|
68
|
-
end
|
data/test/test_tee.rb
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# (The MIT License)
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2018-2024 Yegor Bugayenko
|
|
6
|
-
#
|
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
# furnished to do so, subject to the following conditions:
|
|
13
|
-
#
|
|
14
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
# copies or substantial portions of the Software.
|
|
16
|
-
#
|
|
17
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
# SOFTWARE.
|
|
24
|
-
|
|
25
|
-
require 'minitest/autorun'
|
|
26
|
-
require_relative '../lib/loog'
|
|
27
|
-
require_relative '../lib/loog/tee'
|
|
28
|
-
|
|
29
|
-
# Loog::Tee test.
|
|
30
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
31
|
-
# Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
|
|
32
|
-
# License:: MIT
|
|
33
|
-
class TeeTest < Minitest::Test
|
|
34
|
-
def test_simple_logging
|
|
35
|
-
tee = Loog::Tee.new(Loog::VERBOSE, Loog::REGULAR)
|
|
36
|
-
tee.info('Works?')
|
|
37
|
-
tee.debug('Works?')
|
|
38
|
-
tee.warn('Works?')
|
|
39
|
-
tee.error('Works?')
|
|
40
|
-
end
|
|
41
|
-
end
|