diff -Nru ruby-mixlib-log-1.7.1/CHANGELOG.md ruby-mixlib-log-3.0.8/CHANGELOG.md --- ruby-mixlib-log-1.7.1/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/CHANGELOG.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,133 @@ +# Change Log + + +## [v3.0.8](https://github.com/chef/mixlib-log/tree/v3.0.8) (2019-12-30) + +#### Merged Pull Requests +- Substitute require for require_relative [#59](https://github.com/chef/mixlib-log/pull/59) ([tas50](https://github.com/tas50)) + + + +### Changes not yet released to rubygems.org + +#### Merged Pull Requests +- Substitute require for require_relative [#59](https://github.com/chef/mixlib-log/pull/59) ([tas50](https://github.com/tas50)) +- Test on Ruby 2.7 + random testing improvements [#58](https://github.com/chef/mixlib-log/pull/58) ([tas50](https://github.com/tas50)) +- Add windows testing in Buildkite [#56](https://github.com/chef/mixlib-log/pull/56) ([tas50](https://github.com/tas50)) +- Resolve all warnings emitted during testing [#54](https://github.com/chef/mixlib-log/pull/54) ([zenspider](https://github.com/zenspider)) +- Remove Travis PR Testing [#53](https://github.com/chef/mixlib-log/pull/53) ([tas50](https://github.com/tas50)) +- Add Build Kite PR Testing [#52](https://github.com/chef/mixlib-log/pull/52) ([tas50](https://github.com/tas50)) +- Expand testing / Update GitHub templates [#51](https://github.com/chef/mixlib-log/pull/51) ([tas50](https://github.com/tas50)) + + + +## [v3.0.1](https://github.com/chef/mixlib-log/tree/v3.0.1) (2019-01-05) + +#### Merged Pull Requests +- reverting back to ruby 2.3 support [#48](https://github.com/chef/mixlib-log/pull/48) ([lamont-granquist](https://github.com/lamont-granquist)) + + +## [v3.0.0](https://github.com/chef/mixlib-log/tree/v3.0.0) (2019-01-04) + +#### Merged Pull Requests +- update travis, drop ruby < 2.5, major version bump [#47](https://github.com/chef/mixlib-log/pull/47) ([lamont-granquist](https://github.com/lamont-granquist)) + +## [v2.0.9](https://github.com/chef/mixlib-log/tree/v2.0.9) (2018-12-18) + +#### Merged Pull Requests +- remove hashrocket syntax [#41](https://github.com/chef/mixlib-log/pull/41) ([lamont-granquist](https://github.com/lamont-granquist)) +- Remove the changelog generator gem [#42](https://github.com/chef/mixlib-log/pull/42) ([tas50](https://github.com/tas50)) +- Test on all the Ruby versions we support [#43](https://github.com/chef/mixlib-log/pull/43) ([tas50](https://github.com/tas50)) +- Test on Ruby 2.6 in Travis + test on Xenial [#46](https://github.com/chef/mixlib-log/pull/46) ([tas50](https://github.com/tas50)) +- Only ship the required library files in the gem artifact [#45](https://github.com/chef/mixlib-log/pull/45) ([tas50](https://github.com/tas50)) + +## [v2.0.4](https://github.com/chef/mixlib-log/tree/v2.0.4) (2018-04-12) + +#### Merged Pull Requests +- fix labelling [#37](https://github.com/chef/mixlib-log/pull/37) ([thommay](https://github.com/thommay)) + +## [2.0.1](https://github.com/chef/mixlib-log/tree/2.0.1) (2018-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v2.0.0...2.0.1) + +**Merged pull requests:** + +- enable metadata to be got and set [\#32](https://github.com/chef/mixlib-log/pull/32) ([thommay](https://github.com/thommay)) +- Logging methods \(debug, info, warn, error, fatal\) all return nil [\#27](https://github.com/chef/mixlib-log/pull/27) ([olleolleolle](https://github.com/olleolleolle)) + +## [v2.0.0](https://github.com/chef/mixlib-log/tree/v2.0.0) (2018-02-27) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v1.7.1...v2.0.0) + +**Merged pull requests:** + +- Structured Logging [\#30](https://github.com/chef/mixlib-log/pull/30) ([thommay](https://github.com/thommay)) +- RSpec: use 3.7, disable monkey patching mode [\#28](https://github.com/chef/mixlib-log/pull/28) ([olleolleolle](https://github.com/olleolleolle)) +- README: Format a line of code using Markdown, not RDoc [\#24](https://github.com/chef/mixlib-log/pull/24) ([olleolleolle](https://github.com/olleolleolle)) +- Travis: update Ruby versions, pass lint [\#22](https://github.com/chef/mixlib-log/pull/22) ([olleolleolle](https://github.com/olleolleolle)) +- Require Ruby 2.2+ [\#20](https://github.com/chef/mixlib-log/pull/20) ([tas50](https://github.com/tas50)) + +## [v1.7.1](https://github.com/chef/mixlib-log/tree/v1.7.1) (2016-08-12) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v1.7.0...v1.7.1) + +**Merged pull requests:** + +- Release 1.7.1 [\#19](https://github.com/chef/mixlib-log/pull/19) ([mwrock](https://github.com/mwrock)) +- Allow applications to query if they've got loggers [\#18](https://github.com/chef/mixlib-log/pull/18) ([thommay](https://github.com/thommay)) + +## [v1.7.0](https://github.com/chef/mixlib-log/tree/v1.7.0) (2016-08-04) +[Full Changelog](https://github.com/chef/mixlib-log/compare/1.4.1...v1.7.0) + +**Merged pull requests:** + +- test with updated ruby versions and run cucumber [\#16](https://github.com/chef/mixlib-log/pull/16) ([thommay](https://github.com/thommay)) +- Add dev dependency on chefstyle [\#15](https://github.com/chef/mixlib-log/pull/15) ([tas50](https://github.com/tas50)) +- Misc cleanup + add Travis [\#14](https://github.com/chef/mixlib-log/pull/14) ([tas50](https://github.com/tas50)) +- File log devices opened by mixlib-log should be closed. [\#13](https://github.com/chef/mixlib-log/pull/13) ([mhorbul](https://github.com/mhorbul)) +- Include the license type in the .gemspec [\#9](https://github.com/chef/mixlib-log/pull/9) ([benders](https://github.com/benders)) +- MIXLIB-10: don't be so pessimistic about development libraries [\#8](https://github.com/chef/mixlib-log/pull/8) ([jkeiser](https://github.com/jkeiser)) +- Ensure that arguments to Mixlib::Log\#add are passed as is to all loggers [\#7](https://github.com/chef/mixlib-log/pull/7) ([ketan](https://github.com/ketan)) +- Fixing RDoc formatting of README.rdoc. [\#4](https://github.com/chef/mixlib-log/pull/4) ([ampledata](https://github.com/ampledata)) + +## [1.4.1](https://github.com/chef/mixlib-log/tree/1.4.1) (2012-06-08) +[Full Changelog](https://github.com/chef/mixlib-log/compare/1.4.0...1.4.1) + +## [1.4.0](https://github.com/chef/mixlib-log/tree/1.4.0) (2012-06-08) +[Full Changelog](https://github.com/chef/mixlib-log/compare/1.3.0...1.4.0) + +**Merged pull requests:** + +- Inconsistent documentation about default base log level [\#5](https://github.com/chef/mixlib-log/pull/5) ([bjoernalbers](https://github.com/bjoernalbers)) + +## [1.3.0](https://github.com/chef/mixlib-log/tree/1.3.0) (2011-03-17) +[Full Changelog](https://github.com/chef/mixlib-log/compare/1.2.0...1.3.0) + +## [1.2.0](https://github.com/chef/mixlib-log/tree/1.2.0) (2010-10-15) +[Full Changelog](https://github.com/chef/mixlib-log/compare/alpha_deploy_2...1.2.0) + +## [alpha_deploy_2](https://github.com/chef/mixlib-log/tree/alpha_deploy_2) (2010-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/alpha_deploy_3...alpha_deploy_2) + +## [alpha_deploy_3](https://github.com/chef/mixlib-log/tree/alpha_deploy_3) (2010-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/alpha_deploy_4...alpha_deploy_3) + +## [alpha_deploy_4](https://github.com/chef/mixlib-log/tree/alpha_deploy_4) (2010-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/beta-1...alpha_deploy_4) + +## [beta-1](https://github.com/chef/mixlib-log/tree/beta-1) (2010-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/1.1.0...beta-1) + +## [1.1.0](https://github.com/chef/mixlib-log/tree/1.1.0) (2010-02-28) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v1.1.0...1.1.0) + +## [v1.1.0](https://github.com/chef/mixlib-log/tree/v1.1.0) (2010-01-05) +[Full Changelog](https://github.com/chef/mixlib-log/compare/alpha_deploy_1...v1.1.0) + +## [alpha_deploy_1](https://github.com/chef/mixlib-log/tree/alpha_deploy_1) (2009-05-12) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v1.0.3...alpha_deploy_1) + +## [v1.0.3](https://github.com/chef/mixlib-log/tree/v1.0.3) (2009-05-12) +[Full Changelog](https://github.com/chef/mixlib-log/compare/v1.0.2...v1.0.3) + +## [v1.0.2](https://github.com/chef/mixlib-log/tree/v1.0.2) (2009-05-12) + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff -Nru ruby-mixlib-log-1.7.1/CODE_OF_CONDUCT.md ruby-mixlib-log-3.0.8/CODE_OF_CONDUCT.md --- ruby-mixlib-log-1.7.1/CODE_OF_CONDUCT.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/CODE_OF_CONDUCT.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1 @@ +Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/ diff -Nru ruby-mixlib-log-1.7.1/CONTRIBUTING.md ruby-mixlib-log-3.0.8/CONTRIBUTING.md --- ruby-mixlib-log-1.7.1/CONTRIBUTING.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/CONTRIBUTING.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1 @@ +Please refer to https://github.com/chef/chef/blob/master/CONTRIBUTING.md diff -Nru ruby-mixlib-log-1.7.1/debian/changelog ruby-mixlib-log-3.0.8/debian/changelog --- ruby-mixlib-log-1.7.1/debian/changelog 2016-09-19 17:27:58.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/changelog 2020-02-28 20:29:48.000000000 +0000 @@ -1,3 +1,21 @@ +ruby-mixlib-log (3.0.8-1) unstable; urgency=medium + + * Team upload + + [ HIGUCHI Daisuke (VDR dai) ] + * remove Joshua Timberman from Uploaders with his request. + + [ Utkarsh Gupta ] + * Add salsa-ci.yml + + [ Antonio Terceiro ] + * debian/watch: point at github repository + * New upstream version 3.0.8 + * Refresh packaging files with new run of dh-make-ruby + * Add Breaks: on incompatible versions of chef-zero and ohai + + -- Antonio Terceiro Fri, 28 Feb 2020 17:29:48 -0300 + ruby-mixlib-log (1.7.1-1) unstable; urgency=medium [ Cédric Boutillier ] diff -Nru ruby-mixlib-log-1.7.1/debian/compat ruby-mixlib-log-3.0.8/debian/compat --- ruby-mixlib-log-1.7.1/debian/compat 2016-09-19 17:27:58.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru ruby-mixlib-log-1.7.1/debian/control ruby-mixlib-log-3.0.8/debian/control --- ruby-mixlib-log-1.7.1/debian/control 2016-09-19 17:27:58.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/control 2020-02-28 20:29:48.000000000 +0000 @@ -2,26 +2,28 @@ Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers -Uploaders: Joshua Timberman , - Paul van Tilburg , +Uploaders: Paul van Tilburg , Praveen Arimbrathodiyil -Build-Depends: debhelper (>= 9~), - gem2deb, +Build-Depends: debhelper-compat (= 12), + gem2deb (>= 1), rake, ruby-rspec -Standards-Version: 3.9.8 -Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/ruby-mixlib-log.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-mixlib-log.git -Homepage: https://www.chef.io +Standards-Version: 4.5.0 +Vcs-Git: https://salsa.debian.org/ruby-team/ruby-mixlib-log.git +Vcs-Browser: https://salsa.debian.org/ruby-team/ruby-mixlib-log +Homepage: https://github.com/chef/mixlib-log Testsuite: autopkgtest-pkg-ruby XS-Ruby-Versions: all +Rules-Requires-Root: no Package: ruby-mixlib-log Architecture: all XB-Ruby-Versions: ${ruby:Versions} -Depends: ruby | ruby-interpreter, - ${misc:Depends}, +Depends: ${misc:Depends}, + ${ruby:Depends}, ${shlibs:Depends} +Breaks: ohai (<< 15.7.4-1~), + chef-zero (<< 15.0.0-1~), Description: Simple Ruby mixin for creating a logger object Provides a class based object to provide logging. Messages can be sent at different levels such as warn or error. Logging defaults to STDOUT but diff -Nru ruby-mixlib-log-1.7.1/debian/rules ruby-mixlib-log-3.0.8/debian/rules --- ruby-mixlib-log-1.7.1/debian/rules 2016-09-19 17:27:58.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/rules 2020-02-28 20:29:48.000000000 +0000 @@ -1,6 +1,7 @@ #!/usr/bin/make -f export GEM2DEB_TEST_RUNNER = --check-dependencies +export DH_RUBY = --gem-install %: dh $@ --buildsystem=ruby --with ruby diff -Nru ruby-mixlib-log-1.7.1/debian/upstream/metadata ruby-mixlib-log-3.0.8/debian/upstream/metadata --- ruby-mixlib-log-1.7.1/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/upstream/metadata 2020-02-28 20:29:48.000000000 +0000 @@ -0,0 +1,7 @@ +--- +Archive: GitHub +Bug-Database: https://github.com/chef/mixlib-log/issues +Bug-Submit: https://github.com/chef/mixlib-log/issues +Changelog: https://github.com/chef/mixlib-log/tags +Repository: https://github.com/chef/mixlib-log.git +Repository-Browse: https://github.com/chef/mixlib-log diff -Nru ruby-mixlib-log-1.7.1/debian/watch ruby-mixlib-log-3.0.8/debian/watch --- ruby-mixlib-log-1.7.1/debian/watch 2016-09-19 17:27:58.000000000 +0000 +++ ruby-mixlib-log-3.0.8/debian/watch 2020-02-28 20:29:48.000000000 +0000 @@ -1,2 +1,2 @@ -version=3 -http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/mixlib-log .*/mixlib-log-(.*).tar.gz +version=4 +https://github.com/chef/mixlib-log/releases .*/v(.*).tar.gz diff -Nru ruby-mixlib-log-1.7.1/.expeditor/config.yml ruby-mixlib-log-3.0.8/.expeditor/config.yml --- ruby-mixlib-log-1.7.1/.expeditor/config.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.expeditor/config.yml 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,50 @@ +# Documentation available at https://expeditor.chef.io/docs/getting-started/ +--- + +# Slack channel in Chef Software slack to send notifications about build failures, etc +slack: + notify_channel: chef-found-notify + +# This publish is triggered by the `built_in:publish_rubygems` artifact_action. +rubygems: + - mixlib-log + +github: + # This deletes the GitHub PR branch after successfully merged into the release branch + delete_branch_on_merge: true + # The tag format to use (e.g. v1.0.0) + version_tag_format: "v{{version}}" + # allow bumping the minor release via label + minor_bump_labels: + - "Expeditor: Bump Version Minor" + # allow bumping the major release via label + major_bump_labels: + - "Expeditor: Bump Version Major" + +changelog: + rollup_header: Changes not yet released to rubygems.org + +# These actions are taken, in order they are specified, anytime a Pull Request is merged. +merge_actions: + - built_in:bump_version: + ignore_labels: + - "Expeditor: Skip Version Bump" + - "Expeditor: Skip All" + - bash:.expeditor/update_version.sh: + only_if: built_in:bump_version + - built_in:update_changelog: + ignore_labels: + - "Expeditor: Skip Changelog" + - "Expeditor: Skip All" + - built_in:build_gem: + only_if: built_in:bump_version + +promote: + actions: + - built_in:rollover_changelog + - built_in:publish_rubygems + +pipelines: + - verify: + description: Pull Request validation tests + public: true diff -Nru ruby-mixlib-log-1.7.1/.expeditor/run_linux_tests.sh ruby-mixlib-log-3.0.8/.expeditor/run_linux_tests.sh --- ruby-mixlib-log-1.7.1/.expeditor/run_linux_tests.sh 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.expeditor/run_linux_tests.sh 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/bash +# +# This script runs a passed in command, but first setups up the bundler caching on the repo + +set -ue + +export USER="root" + +echo "--- dependencies" +export LANG=C.UTF-8 LANGUAGE=C.UTF-8 +S3_URL="s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}" + +pull_s3_file() { + aws s3 cp "${S3_URL}/$1" "$1" || echo "Could not pull $1 from S3" +} + +push_s3_file() { + if [ -f "$1" ]; then + aws s3 cp "$1" "${S3_URL}/$1" || echo "Could not push $1 to S3 for caching." + fi +} + +apt-get update -y +apt-get install awscli -y + +echo "--- bundle install" +pull_s3_file "bundle.tar.gz" +pull_s3_file "bundle.sha256" + +if [ -f bundle.tar.gz ]; then + tar -xzf bundle.tar.gz +fi + +if [ -n "${RESET_BUNDLE_CACHE:-}" ]; then + rm bundle.sha256 +fi + +bundle config --local path vendor/bundle +bundle install --jobs=7 --retry=3 + +echo "--- bundle cache" +if test -f bundle.sha256 && shasum --check bundle.sha256 --status; then + echo "Bundled gems have not changed. Skipping upload to s3" +else + echo "Bundled gems have changed. Uploading to s3" + shasum -a 256 Gemfile.lock > bundle.sha256 + tar -czf bundle.tar.gz vendor/ + push_s3_file bundle.tar.gz + push_s3_file bundle.sha256 +fi + +echo "+++ bundle exec task" +bundle exec $1 diff -Nru ruby-mixlib-log-1.7.1/.expeditor/update_version.sh ruby-mixlib-log-3.0.8/.expeditor/update_version.sh --- ruby-mixlib-log-1.7.1/.expeditor/update_version.sh 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.expeditor/update_version.sh 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,12 @@ +#!/bin/sh +# +# After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file. +# It then executes this file to update any other files/components with that new version. +# + +set -evx + +sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/mixlib/log/version.rb + +# Once Expeditor finshes executing this script, it will commit the changes and push +# the commit as a new tag corresponding to the value in the VERSION file. diff -Nru ruby-mixlib-log-1.7.1/.expeditor/verify.pipeline.yml ruby-mixlib-log-3.0.8/.expeditor/verify.pipeline.yml --- ruby-mixlib-log-1.7.1/.expeditor/verify.pipeline.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.expeditor/verify.pipeline.yml 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,47 @@ +--- +expeditor: + defaults: + buildkite: + timeout_in_minutes: 30 + +steps: + +- label: run-lint-and-specs-ruby-2.4 + command: + - .expeditor/run_linux_tests.sh rake + expeditor: + executor: + docker: + image: ruby:2.4-buster + +- label: run-lint-and-specs-ruby-2.5 + command: + - .expeditor/run_linux_tests.sh rake + expeditor: + executor: + docker: + image: ruby:2.5-buster + +- label: run-lint-and-specs-ruby-2.6 + command: + - .expeditor/run_linux_tests.sh rake + expeditor: + executor: + docker: + image: ruby:2.6-buster +- label: run-lint-and-specs-ruby-2.7rc + command: + - .expeditor/run_linux_tests.sh rake + expeditor: + executor: + docker: + image: ruby:2.7-rc-buster + +- label: run-specs-windows + command: + - bundle install --jobs=7 --retry=3 --without docs debug + - bundle exec rake + expeditor: + executor: + docker: + host_os: windows diff -Nru ruby-mixlib-log-1.7.1/features/log.feature ruby-mixlib-log-3.0.8/features/log.feature --- ruby-mixlib-log-1.7.1/features/log.feature 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/features/log.feature 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,37 @@ +Feature: Log output + In order to keep a record of application specific information + As a developer + I want to publish information through a configurable log interface + + Scenario: Log a message at the debug level + Given a base log level of 'debug' + When the message 'this goes out' is sent at the 'debug' level + Then the regex '\[.+\] DEBUG: this goes out' should be logged + + Scenario: Log a message at the info level + Given a base log level of 'info' + When the message 'this goes out' is sent at the 'info' level + Then the regex '\[.+\] INFO: this goes out' should be logged + + Scenario: Log a message at the warn level + Given a base log level of 'warn' + When the message 'this goes out' is sent at the 'warn' level + Then the regex '\[.+\] WARN: this goes out' should be logged + + Scenario: Log a message at the error level + Given a base log level of 'error' + When the message 'this goes out' is sent at the 'error' level + Then the regex '\[.+\] ERROR: this goes out' should be logged + + Scenario: Log a message at the fatal level + Given a base log level of 'fatal' + When the message 'this goes out' is sent at the 'fatal' level + Then the regex '\[.+\] FATAL: this goes out' should be logged + + Scenario: Log messages below the current threshold should not appear + Given a base log level of 'fatal' + When the message 'this goes out' is sent at the 'error' level + And the message 'this goes out' is sent at the 'warn' level + And the message 'this goes out' is sent at the 'info' level + And the message 'this goes out' is sent at the 'debug' level + Then nothing should be logged diff -Nru ruby-mixlib-log-1.7.1/features/steps/log.rb ruby-mixlib-log-3.0.8/features/steps/log.rb --- ruby-mixlib-log-1.7.1/features/steps/log.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/features/steps/log.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,47 @@ +# +# Author:: Adam Jacob () +# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +Given(/^a base log level of '(.+)'$/) do |level| + Logit.level = level.to_sym +end + +When(/^the message '(.+)' is sent at the '(.+)' level$/) do |message, level| + case level.to_sym + when :debug + Logit.debug(message) + when :info + Logit.info(message) + when :warn + Logit.warn(message) + when :error + Logit.error(message) + when :fatal + Logit.fatal(message) + else + raise ArgumentError, "Level is not one of debug, info, warn, error, or fatal" + end +end + +Then(/^the regex '(.+)' should be logged$/) do |regex_string| + regex = Regexp.new(regex_string, Regexp::MULTILINE) + expect(regex.match(@output)).not_to be_nil +end + +Then(/^nothing should be logged$/) do + expect(@output).to eq "" +end diff -Nru ruby-mixlib-log-1.7.1/features/support/env.rb ruby-mixlib-log-3.0.8/features/support/env.rb --- ruby-mixlib-log-1.7.1/features/support/env.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/features/support/env.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,45 @@ +# +# Author:: Adam Jacob () +# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +$: << File.join(File.dirname(__FILE__), "..", "..", "lib") + +require "rspec/expectations" +require "mixlib/log" +require "tmpdir" +require "stringio" + +class MyWorld + def initialize + @tmpdir = File.join(Dir.tmpdir, "mixlib_log") + @output = "" + @output_io = StringIO.new(@output) + Logit.init(@output_io) + end +end + +World do + MyWorld.new +end + +Before do + system("mkdir -p #{@tmpdir}") +end + +After do + system("rm -rf #{@tmpdir}") +end diff -Nru ruby-mixlib-log-1.7.1/features/support/logit.rb ruby-mixlib-log-3.0.8/features/support/logit.rb --- ruby-mixlib-log-1.7.1/features/support/logit.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/features/support/logit.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,21 @@ +# +# Author:: Adam Jacob () +# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class Logit + extend Mixlib::Log +end diff -Nru ruby-mixlib-log-1.7.1/Gemfile ruby-mixlib-log-3.0.8/Gemfile --- ruby-mixlib-log-1.7.1/Gemfile 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/Gemfile 2019-12-30 01:02:29.000000000 +0000 @@ -2,8 +2,22 @@ gemspec -group :development do - gem "rdoc" - gem "bundler" - gem "rack", "< 2.0" +group :docs do + gem "github-markup" + gem "redcarpet" + gem "yard" +end + +group :test do + gem "chefstyle" + gem "cucumber" + gem "rake" + gem "rspec", "~> 3.7" +end + +group :debug do + gem "pry" + gem "pry-byebug" + gem "pry-stack_explorer" + gem "rb-readline" end diff -Nru ruby-mixlib-log-1.7.1/.github/CODEOWNERS ruby-mixlib-log-3.0.8/.github/CODEOWNERS --- ruby-mixlib-log-1.7.1/.github/CODEOWNERS 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/CODEOWNERS 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,5 @@ +# Order is important. The last matching pattern has the most precedence. + +* @chef/chef-foundation-owners @chef/chef-foundation-approvers @chef/chef-foundation-reviewers +.expeditor/ @chef/jex-team +*.md @chef/docs-team diff -Nru ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md --- ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,29 @@ +--- +name: � Bug Report +about: If something isn't working as expected �. +labels: "Status: Untriaged, Type: Bug" +--- + +# Version: + +[Version of the project installed] + +# Environment: + +[Details about the environment such as the Operating System, cookbook details, etc...] + +# Scenario: + +[What you are trying to achieve and you can't?] + +# Steps to Reproduce: + +[If you are filing an issue what are the things we need to do in order to repro your problem?] + +# Expected Result: + +[What are you expecting to happen as the consequence of above reproduction steps?] + +# Actual Result: + +[What actually happens after the reproduction steps?] diff -Nru ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md --- ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,40 @@ +--- +name: Design Proposal +about: I have a significant change I would like to propose and discuss before starting +labels: "Status: Untriaged, Type: Design Proposal" +--- + +### When a Change Needs a Design Proposal + +A design proposal should be opened any time a change meets one of the following qualifications: + +- Significantly changes the user experience of a project in a way that impacts users. +- Significantly changes the underlying architecture of the project in a way that impacts other developers. +- Changes the development or testing process of the project such as a change of CI systems or test frameworks. + +### Why We Use This Process + +- Allows all interested parties (including any community member) to discuss large impact changes to a project. +- Serves as a durable paper trail for discussions regarding project architecture. +- Forces design discussions to occur before PRs are created. +- Reduces PR refactoring and rejected PRs. + +--- + + + +## Motivation + + + +## Specification + + + +## Downstream Impact + + diff -Nru ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md --- ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,17 @@ +--- +name: 🚀 Enhancement Request +about: I have a suggestion (and may want to implement it 🙂)! +labels: "Status: Untriaged" +--- + +### Describe the Enhancement: + + +### Describe the Need: + + +### Current Alternative + + +### Can We Help You Implement This?: + diff -Nru ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md --- ruby-mixlib-log-1.7.1/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,11 @@ +--- +name: 🤗 Support Question +about: If you have a question 💬, please check out our Slack! +--- + +We use GitHub issues to track bugs and feature requests. If you need help please post to our Mailing List or join the Chef Community Slack. + + * Chef Community Slack at http://community-slack.chef.io/. + * Chef Mailing List https://discourse.chef.io/ + + Support issues opened here will be closed and redirected to Slack or Discourse. diff -Nru ruby-mixlib-log-1.7.1/.github/lock.yml ruby-mixlib-log-3.0.8/.github/lock.yml --- ruby-mixlib-log-1.7.1/.github/lock.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.github/lock.yml 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1 @@ +daysUntilLock: 60 diff -Nru ruby-mixlib-log-1.7.1/.gitignore ruby-mixlib-log-3.0.8/.gitignore --- ruby-mixlib-log-1.7.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.gitignore 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,9 @@ +*.sw? +.DS_Store +coverage +rdoc +pkg +.rake_tasks~ +.bundle +Gemfile.lock +vendor diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log/child.rb ruby-mixlib-log-3.0.8/lib/mixlib/log/child.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log/child.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log/child.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,61 @@ +# +# Copyright:: Copyright (c) 2018 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require_relative "logging" + +module Mixlib + module Log + class Child + include Mixlib::Log::Logging + + attr_reader :parent + attr_accessor :metadata + def initialize(parent, metadata = {}) + @parent = parent + @metadata = metadata + end + + def level + parent.level + end + + # Define the methods to interrogate the logger for the current log level. + # Note that we *only* query the default logger (@logger) and not any other + # loggers that may have been added, even though it is possible to configure + # two (or more) loggers at different log levels. + %i{trace? debug? info? warn? error? fatal?}.each do |method_name| + define_method(method_name) do + parent.send(method_name) + end + end + + def add(severity, message = nil, progname = nil, data: {}, &block) + data = metadata.merge(data) if data.is_a?(Hash) + parent.send(:pass, severity, message, progname, data: data, &block) + end + + def with_child(metadata = {}) + child = Child.new(self, metadata) + if block_given? + yield child + else + child + end + end + + end + end +end diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log/formatter.rb ruby-mixlib-log-3.0.8/lib/mixlib/log/formatter.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log/formatter.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log/formatter.rb 2019-12-30 01:02:29.000000000 +0000 @@ -31,7 +31,7 @@ # Otherwise, doesn't print the time. def call(severity, time, progname, msg) if @@show_time - sprintf("[%s] %s: %s\n", time.iso8601(), severity, msg2str(msg)) + sprintf("[%s] %s: %s\n", time.iso8601, severity, msg2str(msg)) else sprintf("%s: %s\n", severity, msg2str(msg)) end @@ -42,15 +42,25 @@ # put through "object.inspect" def msg2str(msg) case msg + when ::Hash + if msg.has_key?(:err) + format_exception(msg[:err]) + else + msg[:msg] + end when ::String msg when ::Exception - "#{ msg.message } (#{ msg.class })\n" << - (msg.backtrace || []).join("\n") + format_exception(msg) else msg.inspect end end + + def format_exception(msg) + "#{msg.message} (#{msg.class})\n" << + (msg.backtrace || []).join("\n") + end end end end diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log/logger.rb ruby-mixlib-log-3.0.8/lib/mixlib/log/logger.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log/logger.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log/logger.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,111 @@ +require "logger" +require_relative "logging" + +# A subclass of Ruby's stdlib Logger with all the mutex and logrotation stuff +# ripped out, and metadata added in. +module Mixlib + module Log + class Logger < ::Logger + + include Logging + + def trace?; @level <= TRACE; end + + # + # === Synopsis + # + # Logger.new(name, shift_age = 7, shift_size = 1048576) + # Logger.new(name, shift_age = 'weekly') + # + # === Args + # + # +logdev+:: + # The log device. This is a filename (String) or IO object (typically + # +$stdout+, +$stderr+, or an open file). + # +shift_age+:: + # Number of old log files to keep, *or* frequency of rotation (+daily+, + # +weekly+ or +monthly+). + # +shift_size+:: + # Maximum logfile size (only applies when +shift_age+ is a number). + # + # === Description + # + # Create an instance. + # + def initialize(logdev) + @progname = nil + @level = DEBUG + @default_formatter = Formatter.new + @formatter = nil + @logdev = nil + if logdev + @logdev = LocklessLogDevice.new(logdev) + end + end + + def add_data(severity, message, progname, data: {}) + return true if @logdev.nil? || severity < @level + + data ||= {} + if message.is_a?(::Exception) + data[:err] = message + else + data[:msg] = message + end + @logdev.write( + format_message(to_label(severity), Time.now, progname, data) + ) + true + end + alias_method :add, :add_data + + class LocklessLogDevice < LogDevice + + def initialize(log = nil) + @dev = @filename = @shift_age = @shift_size = nil + if log.respond_to?(:write) && log.respond_to?(:close) + @dev = log + else + @dev = open_logfile(log) + @filename = log + end + @dev.sync = true + end + + def write(message) + @dev.write(message) + rescue Exception => ignored + warn("log writing failed. #{ignored}") + end + + def close + @dev.close rescue nil + end + + private + + def open_logfile(filename) + if FileTest.exist?(filename) + open(filename, (File::WRONLY | File::APPEND)) + else + create_logfile(filename) + end + end + + def create_logfile(filename) + logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT)) + add_log_header(logdev) + logdev + end + + def add_log_header(file) + file.write( + "# Logfile created on %s by %s\n" % [Time.now.to_s, Logger::ProgName] + ) + end + + end + + end + end +end diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log/logging.rb ruby-mixlib-log-3.0.8/lib/mixlib/log/logging.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log/logging.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log/logging.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,54 @@ +# +# Copyright:: Copyright (c) 2018 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require "logger" + +module Mixlib + module Log + module Logging + include ::Logger::Severity + + TRACE = -1 + + SEV_LABEL = %w{TRACE DEBUG INFO WARN ERROR FATAL ANY}.each(&:freeze).freeze + + def to_label(sev) + SEV_LABEL[sev + 1] || -"ANY" + end + + LEVELS = { trace: TRACE, debug: DEBUG, info: INFO, warn: WARN, error: ERROR, fatal: FATAL }.freeze + LEVEL_NAMES = LEVELS.invert.freeze + + attr_accessor :metadata + + def pass(severity, args, progname = nil, data: {}, &block) + args, progname, data = yield if block_given? + add(severity, args, progname, data: data) + end + + # Define the standard logger methods on this class programmatically. + # No need to incur method_missing overhead on every log call. + %i{trace debug info warn error fatal}.each do |method_name| + level = LEVELS[method_name] + define_method(method_name) do |msg = nil, data: {}, &block| + pass(level, msg, data: data, &block) + nil + end + end + + end + end +end diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log/version.rb ruby-mixlib-log-3.0.8/lib/mixlib/log/version.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log/version.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log/version.rb 2019-12-30 01:02:29.000000000 +0000 @@ -1,5 +1,5 @@ module Mixlib module Log - VERSION = "1.7.1" + VERSION = "3.0.8".freeze end end diff -Nru ruby-mixlib-log-1.7.1/lib/mixlib/log.rb ruby-mixlib-log-3.0.8/lib/mixlib/log.rb --- ruby-mixlib-log-1.7.1/lib/mixlib/log.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/lib/mixlib/log.rb 2019-12-30 01:02:29.000000000 +0000 @@ -17,24 +17,27 @@ # limitations under the License. require "logger" -require "mixlib/log/version" -require "mixlib/log/formatter" +require_relative "log/version" +require_relative "log/formatter" +require_relative "log/child" +require_relative "log/logging" +require_relative "log/logger" module Mixlib module Log - @logger, @loggers = nil - - LEVELS = { :debug => Logger::DEBUG, :info => Logger::INFO, :warn => Logger::WARN, :error => Logger::ERROR, :fatal => Logger::FATAL }.freeze - LEVEL_NAMES = LEVELS.invert.freeze + include Logging def reset! + @logger ||= nil + @loggers ||= [] close! - @logger, @loggers = nil, nil + @logger = @loggers = nil + @metadata = {} end # An Array of log devices that will be logged to. Defaults to just the default - # @logger log device, but you can push to this array to add more devices. + # \@logger log device, but you can push to this array to add more devices. def loggers @loggers ||= [logger] end @@ -44,7 +47,7 @@ # and creates a new one if it doesn't yet exist ## def logger - @logger || init + @logger ||= init end # Sets the log device to +new_log_device+. Any additional loggers @@ -58,7 +61,7 @@ if other.respond_to?(:loggers) && other.respond_to?(:logger) @loggers = other.loggers @logger = other.logger - elsif other.kind_of?(Array) + elsif other.is_a?(Array) @loggers = other @logger = other.first else @@ -79,9 +82,11 @@ def init(*opts) reset! @logger = logger_for(*opts) - @logger.formatter = Mixlib::Log::Formatter.new() if @logger.respond_to?(:formatter=) + @logger.formatter = Mixlib::Log::Formatter.new if @logger.respond_to?(:formatter=) @logger.level = Logger::WARN @configured = true + @parent = nil + @metadata = {} @logger end @@ -90,8 +95,11 @@ @configured end + attr_accessor :metadata + # Sets the level for the Logger object by symbol. Valid arguments are: # + # :trace # :debug # :info # :warn @@ -101,7 +109,8 @@ # Throws an ArgumentError if you feed it a bogus log level. def level=(new_level) level_int = LEVEL_NAMES.key?(new_level) ? new_level : LEVELS[new_level] - raise ArgumentError, "Log level must be one of :debug, :info, :warn, :error, or :fatal" if level_int.nil? + raise ArgumentError, "Log level must be one of :trace, :debug, :info, :warn, :error, or :fatal" if level_int.nil? + loggers.each { |l| l.level = level_int } end @@ -113,38 +122,45 @@ end end - # Define the standard logger methods on this class programmatically. - # No need to incur method_missing overhead on every log call. - [:debug, :info, :warn, :error, :fatal].each do |method_name| - class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) - def #{method_name}(msg=nil, &block) - loggers.each {|l| l.#{method_name}(msg, &block) } - end - METHOD_DEFN - end - # Define the methods to interrogate the logger for the current log level. # Note that we *only* query the default logger (@logger) and not any other # loggers that may have been added, even though it is possible to configure # two (or more) loggers at different log levels. - [:debug?, :info?, :warn?, :error?, :fatal?].each do |method_name| - class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) - def #{method_name} - logger.#{method_name} - end - METHOD_DEFN + %i{trace? debug? info? warn? error? fatal?}.each do |method_name| + define_method(method_name) do + logger.send(method_name) + end end def <<(msg) loggers.each { |l| l << msg } end - def add(severity, message = nil, progname = nil, &block) - loggers.each { |l| l.add(severity, message, progname, &block) } + def add(severity, message = nil, progname = nil, data: {}, &block) + message, progname, data = yield if block_given? + data = metadata.merge(data) if metadata.is_a?(Hash) && data.is_a?(Hash) + loggers.each do |l| + # if we don't have any metadata, let's not do the potentially expensive + # merging and managing that this call requires + if l.respond_to?(:add_data) && !data.nil? && !data.empty? + l.add_data(severity, message, progname, data: data) + else + l.add(severity, message, progname) + end + end end alias :log :add + def with_child(metadata = {}) + child = Child.new(self, metadata) + if block_given? + yield child + else + child + end + end + # Passes any other method calls on directly to the underlying Logger object created with init. If # this method gets hit before a call to Mixlib::Logger.init has been made, it will call # Mixlib::Logger.init() with no arguments. @@ -156,11 +172,11 @@ def logger_for(*opts) if opts.empty? - Logger.new(STDOUT) + Mixlib::Log::Logger.new($stdout) elsif LEVELS.keys.inject(true) { |quacks, level| quacks && opts.first.respond_to?(level) } opts.first else - Logger.new(*opts) + Mixlib::Log::Logger.new(*opts) end end @@ -176,7 +192,9 @@ # via public API. In order to reduce amount of impact and # handle only File type log devices I had to use this method # to get access to it. - next unless logdev = logger.instance_variable_get(:"@logdev") + next unless logger.instance_variable_defined?(:"@logdev") + next unless (logdev = logger.instance_variable_get(:"@logdev")) + loggers_to_close << logger if logdev.filename end loggers_to_close diff -Nru ruby-mixlib-log-1.7.1/mixlib-log.gemspec ruby-mixlib-log-3.0.8/mixlib-log.gemspec --- ruby-mixlib-log-1.7.1/mixlib-log.gemspec 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/mixlib-log.gemspec 2019-12-30 01:02:29.000000000 +0000 @@ -4,18 +4,12 @@ Gem::Specification.new do |gem| gem.name = "mixlib-log" gem.version = Mixlib::Log::VERSION - gem.platform = Gem::Platform::RUBY gem.summary = "A gem that provides a simple mixin for log functionality" gem.email = "info@chef.io" - gem.homepage = "https://www.chef.io" + gem.homepage = "https://github.com/chef/mixlib-log" gem.license = "Apache-2.0" gem.authors = ["Chef Software, Inc."] - gem.has_rdoc = true - gem.extra_rdoc_files = ["README.md", "LICENSE", "NOTICE"] - gem.files = Dir["lib/**/*"] + Dir["spec/**/*"] + ["Gemfile", "Rakefile", ".gemtest", "mixlib-log.gemspec"] - gem.add_development_dependency "rake" - gem.add_development_dependency "rspec", "~> 3.4" - gem.add_development_dependency "chefstyle", "~> 0.3" - gem.add_development_dependency "cucumber" - gem.add_development_dependency "github_changelog_generator", "1.11.3" + gem.files = %w{LICENSE} + Dir.glob("lib/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + gem.require_paths = ["lib"] + gem.required_ruby_version = ">= 2.3" end diff -Nru ruby-mixlib-log-1.7.1/Rakefile ruby-mixlib-log-3.0.8/Rakefile --- ruby-mixlib-log-1.7.1/Rakefile 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/Rakefile 2019-12-30 01:02:29.000000000 +0000 @@ -1,43 +1,56 @@ -require "bundler/gem_tasks" -require "rdoc/task" -require "rspec/core/rake_task" -require "cucumber/rake/task" +require "bundler" -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = "spec/**/*_spec.rb" -end - -task :default => :spec - -# For rubygems-test -task :test => :spec +begin + require "cucumber/rake/task" -RDoc::Task.new do |rdoc| - rdoc.rdoc_dir = "rdoc" - rdoc.title = "mixlib-log #{Mixlib::Log::VERSION}" - rdoc.rdoc_files.include("README*") - rdoc.rdoc_files.include("lib/**/*.rb") + Cucumber::Rake::Task.new(:features) do |t| + t.cucumber_opts = "--format pretty" + t.bundler = false + end +rescue LoadError + desc "cucumber is not installed, this task is disabled" + task :spec do + abort "cucumber is not installed. bundle install first to make sure all dependencies are installed." + end end -Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = "--format pretty" +begin + require "rspec/core/rake_task" + + RSpec::Core::RakeTask.new do |t| + t.pattern = "spec/**/*_spec.rb" + end +rescue LoadError + desc "rspec is not installed, this task is disabled" + task :spec do + abort "rspec is not installed. bundle install first to make sure all dependencies are installed." + end end begin require "chefstyle" require "rubocop/rake_task" + desc "Run Chefstyle tests" RuboCop::RakeTask.new(:style) do |task| task.options += ["--display-cop-names", "--no-color"] end rescue LoadError - puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking." + puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed." end -require "github_changelog_generator/task" +begin + require "yard" + YARD::Rake::YardocTask.new(:docs) +rescue LoadError + puts "yard is not available. bundle install first to make sure all dependencies are installed." +end -GitHubChangelogGenerator::RakeTask.new :changelog do |config| - config.future_release = Mixlib::Log::VERSION - config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",") - config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",") - config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",") +task :console do + require "irb" + require "irb/completion" + require "mixlib/log" + ARGV.clear + IRB.start end + +task default: %i{style spec features} diff -Nru ruby-mixlib-log-1.7.1/README.md ruby-mixlib-log-3.0.8/README.md --- ruby-mixlib-log-1.7.1/README.md 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/README.md 2019-12-30 01:02:29.000000000 +0000 @@ -1,6 +1,15 @@ # Mixlib::Log -[![Build Status Master](https://travis-ci.org/chef/mixlib-log.svg?branch=master)](https://travis-ci.org/chef/mixlib-log) [![Gem Version](https://badge.fury.io/rb/mixlib-log.svg)](https://badge.fury.io/rb/mixlib-log) +[![Gem Version](https://badge.fury.io/rb/mixlib-log.svg)](https://badge.fury.io/rb/mixlib-log) +[![Build status](https://badge.buildkite.com/cb1e5b6f3cc77071f4b2315f6b605fe60d86e2862a490873d4.svg?branch=master)](https://buildkite.com/chef-oss/chef-mixlib-log-master-verify) + +**Umbrella Project**: [Chef Foundation](https://github.com/chef/chef-oss-practices/blob/master/projects/chef-foundation.md) + +**Project State**: [Active](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md#active) + +**Issues [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md)**: 14 days + +**Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md)**: 14 days Mixlib::Log provides a mixin for enabling a class based logger object, a-la Merb, Chef, and Nanite. To use it: @@ -22,18 +31,30 @@ Log.fatal('wewt') ``` -By default, `Mixlib::Logger` logs to STDOUT. To alter this, you should call +Log.init+, passing any arguments to the standard Ruby Logger. For example: +By default, `Mixlib::Logger` logs to STDOUT. To alter this, you should call `Log.init`, passing any arguments to the standard Ruby Logger. For example: ```ruby -Log.init('/tmp/logfile') # log to /tmp/logfile +Log.init('/tmp/logfile') # log to /tmp/logfile Log.init('/tmp/logfile', 7) # log to /tmp/logfile, rotate every day ``` Enjoy! -## LICENSE: +## Documentation + +All documentation is written using YARD. You can generate a by running: + +``` +rake docs +``` + +## Contributing + +For information on contributing to this project please see our [Contributing Documentation](https://github.com/chef/chef/blob/master/CONTRIBUTING.md) + +## License & Copyright -- Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. +- Copyright:: Copyright (c) 2008-2019 Chef Software, Inc. - License:: Apache License, Version 2.0 ```text diff -Nru ruby-mixlib-log-1.7.1/.rspec ruby-mixlib-log-3.0.8/.rspec --- ruby-mixlib-log-1.7.1/.rspec 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.rspec 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,2 @@ +--colour +--format documentation diff -Nru ruby-mixlib-log-1.7.1/.rubocop.yml ruby-mixlib-log-3.0.8/.rubocop.yml --- ruby-mixlib-log-1.7.1/.rubocop.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/.rubocop.yml 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,3 @@ +Style/PreferredHashMethods: + Exclude: + - 'lib/mixlib/log/formatter.rb' diff -Nru ruby-mixlib-log-1.7.1/spec/mixlib/log/child_spec.rb ruby-mixlib-log-3.0.8/spec/mixlib/log/child_spec.rb --- ruby-mixlib-log-1.7.1/spec/mixlib/log/child_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/spec/mixlib/log/child_spec.rb 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1,99 @@ +# +# Copyright:: Copyright (c) 2018 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "tempfile" +require "stringio" +require "spec_helper" + +RSpec.describe Mixlib::Log::Child do + before do + Logit.reset! + Logit.init(io) + Logit.level = :warn + end + + let(:io) { StringIO.new } + + let(:child) { Logit.with_child } + + it "has a parent" do + expect(child.parent).to be(Logit) + end + + it "accepts a message" do + Logit.with_child { |l| l.add(Logger::WARN, "a message") } + expect(io.string).to match(/a message$/) + end + + context "with structured data" do + it "can be created with metadata" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true" }) + Logit.with_child({ child: "true" }) { |l| l.warn("a message") } + end + + it "a message can be logged" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true" }) + Logit.with_child { |l| l.warn("a message", data: { child: "true" }) } + end + + context "merges properly" do + it "in the simple case" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true", meta: "data" }) + Logit.with_child(meta: "data") { |l| l.warn("a message", data: { child: "true" }) } + end + + it "when overwriting" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true", meta: "overwritten" }) + Logit.with_child(meta: "data") { |l| l.warn("a message", data: { child: "true", meta: "overwritten" }) } + end + end + + context "when receiving a message from a child" do + it "passes data on" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true", parent: "first" }) + child.metadata = { parent: "first" } + child.with_child { |l| l.warn("a message", data: { child: "true" }) } + end + + it "merges its own data" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[:warn], "a message", nil, data: { child: "true", parent: "second" }) + child.metadata = { parent: "first" } + child.with_child { |l| l.warn("a message", data: { child: "true", parent: "second" }) } + end + end + end + + context "sends a message to the parent" do + %i{ debug info warn error fatal }.each do |level| + it "at #{level}" do + expect(Logit).to receive(:pass).with(Mixlib::Log::LEVELS[level], "a #{level} message", nil, data: {}) + Logit.level = level + child.send(level, "a #{level} message") + end + end + end + + context "can query the parent's level" do + %i{ debug info warn error fatal }.each do |level| + it "at #{level}" do + query = "#{level}?".to_sym + Logit.level = level + expect(child.send(query)).to be(true) + end + end + end +end diff -Nru ruby-mixlib-log-1.7.1/spec/mixlib/log/formatter_spec.rb ruby-mixlib-log-3.0.8/spec/mixlib/log/formatter_spec.rb --- ruby-mixlib-log-1.7.1/spec/mixlib/log/formatter_spec.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/spec/mixlib/log/formatter_spec.rb 2019-12-30 01:02:29.000000000 +0000 @@ -19,7 +19,7 @@ require "time" require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) -describe Mixlib::Log::Formatter do +RSpec.describe Mixlib::Log::Formatter do before(:each) do @formatter = Mixlib::Log::Formatter.new end @@ -48,4 +48,17 @@ expect(@formatter.call("monkey", Time.new, "test", "mos def")).to eq("monkey: mos def\n") end + context "with structured data" do + let(:data) { {} } + + it "should format a message" do + data[:msg] = "nuthin new" + expect(@formatter.msg2str(data)).to eq("nuthin new") + end + + it "should format an exception" do + data[:err] = IOError.new("legendary roots crew") + expect(@formatter.msg2str(data)).to eq("legendary roots crew (IOError)\n") + end + end end diff -Nru ruby-mixlib-log-1.7.1/spec/mixlib/log_spec.rb ruby-mixlib-log-3.0.8/spec/mixlib/log_spec.rb --- ruby-mixlib-log-1.7.1/spec/mixlib/log_spec.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/spec/mixlib/log_spec.rb 2019-12-30 01:02:29.000000000 +0000 @@ -19,16 +19,26 @@ require "tempfile" require "stringio" -require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper")) +require "spec_helper" class LoggerLike attr_accessor :level - attr_reader :messages + attr_reader :messages, :data def initialize @messages = "" + @data = [] end - [:debug, :info, :warn, :error, :fatal].each do |method_name| + def add_data(severity, message = nil, progname = nil, data: {}) + @messages << message + @data << data + end + + def add(severity, message = nil, progname = nil, data: {}) + @messages << message + end + + %i{trace debug info warn error fatal}.each do |method_name| class_eval(<<-E) def #{method_name}(message) @messages << message @@ -37,7 +47,7 @@ end end -describe Mixlib::Log do +RSpec.describe Mixlib::Log do # Since we are testing class behaviour for an instance variable # that gets set once, we need to reset it prior to each example [cb] @@ -64,6 +74,7 @@ it "uses the logger provided when initialized with a logger like object" do logger = LoggerLike.new Logit.init(logger) + Logit.level = :debug Logit.debug "qux" expect(logger.messages).to match(/qux/) end @@ -84,13 +95,14 @@ expect(Logit.configured?).to be true end - it "should set the log level using the binding form, with :debug, :info, :warn, :error, or :fatal" do + it "should set the log level using the binding form, with :trace, :debug, :info, :warn, :error, or :fatal" do levels = { - :debug => Logger::DEBUG, - :info => Logger::INFO, - :warn => Logger::WARN, - :error => Logger::ERROR, - :fatal => Logger::FATAL, + trace: Mixlib::Log::TRACE, + debug: Mixlib::Log::DEBUG, + info: Mixlib::Log::INFO, + warn: Mixlib::Log::WARN, + error: Mixlib::Log::ERROR, + fatal: Mixlib::Log::FATAL, } levels.each do |symbol, constant| Logit.level = symbol @@ -106,13 +118,14 @@ expect(logdev.string).to match(/the_message/) end - it "should set the log level using the method form, with :debug, :info, :warn, :error, or :fatal" do + it "should set the log level using the method form, with :trace, :debug, :info, :warn, :error, or :fatal" do levels = { - :debug => Logger::DEBUG, - :info => Logger::INFO, - :warn => Logger::WARN, - :error => Logger::ERROR, - :fatal => Logger::FATAL, + trace: Mixlib::Log::TRACE, + debug: Mixlib::Log::DEBUG, + info: Mixlib::Log::INFO, + warn: Mixlib::Log::WARN, + error: Mixlib::Log::ERROR, + fatal: Mixlib::Log::FATAL, } levels.each do |symbol, constant| Logit.level(symbol) @@ -121,17 +134,22 @@ end it "should raise an ArgumentError if you try and set the level to something strange using the binding form" do - expect(lambda { Logit.level = :the_roots }).to raise_error(ArgumentError) + expect { Logit.level = :the_roots }.to raise_error(ArgumentError) end it "should raise an ArgumentError if you try and set the level to something strange using the method form" do - expect(lambda { Logit.level(:the_roots) }).to raise_error(ArgumentError) + expect { Logit.level(:the_roots) }.to raise_error(ArgumentError) end it "should pass other method calls directly to logger" do - Logit.level = :debug - expect(Logit).to be_debug - expect(lambda { Logit.debug("Gimme some sugar!") }).to_not raise_error + expect do + # this needs to be inside of the block because the level setting + # is causing the init, which grabs $stderr before rspec replaces + # it for output testing. + Logit.level = :debug + expect(Logit).to be_debug + Logit.debug("Gimme some sugar!") + end.to output(/DEBUG: Gimme some sugar!/).to_stdout end it "should pass add method calls directly to logger" do @@ -139,12 +157,13 @@ Logit.init(logdev) Logit.level = :debug expect(Logit).to be_debug - expect(lambda { Logit.add(Logger::DEBUG, "Gimme some sugar!") }).to_not raise_error + expect { Logit.add(Logger::DEBUG, "Gimme some sugar!") }.to_not raise_error expect(logdev.string).to match(/Gimme some sugar/) end it "should default to STDOUT if init is called with no arguments" do logger_mock = Struct.new(:formatter, :level).new + # intentionally STDOUT to avoid unfailable test expect(Logger).to receive(:new).with(STDOUT).and_return(logger_mock) Logit.init end @@ -161,9 +180,10 @@ ObjectSpace.each_object(File) do |f| opened_files_count_before += 1 unless f.closed? end - Logit.init("/tmp/logger.log") - Logit.init("/tmp/logger.log") - Logit.init("/tmp/logger.log") + name = File.join(Dir.tmpdir, "logger.log") + Logit.init(name) + Logit.init(name) + Logit.init(name) opened_files_count_after = 0 ObjectSpace.each_object(File) do |f| opened_files_count_after += 1 unless f.closed? @@ -176,15 +196,46 @@ ObjectSpace.each_object(File) do |f| opened_files_count_before += 1 unless f.closed? end - file = File.open("/tmp/logger.log") - Logit.init(file) - Logit.init(file) - Logit.init(file) - opened_files_count_after = 0 - ObjectSpace.each_object(File) do |f| - opened_files_count_after += 1 unless f.closed? + Tempfile.open("chef-test-log") do |file| + Logit.init(file) + Logit.init(file) + Logit.init(file) + opened_files_count_after = 0 + ObjectSpace.each_object(File) do |f| + opened_files_count_after += 1 unless f.closed? + end + expect(opened_files_count_after).to eq(opened_files_count_before + 1) end - expect(opened_files_count_after).to eq(opened_files_count_before + 1) end + it "should return nil from its logging methods" do + # intentionally STDOUT to avoid unfailable test + expect(Logger).to receive(:new).with(STDOUT) { double("a-quiet-logger").as_null_object } + Logit.init + + aggregate_failures "returns nil from logging method" do + expect(Logit.trace("hello")).to be_nil + expect(Logit.debug("hello")).to be_nil + expect(Logit.info("hello")).to be_nil + expect(Logit.warn("hello")).to be_nil + expect(Logit.error("hello")).to be_nil + expect(Logit.fatal("hello")).to be_nil + end + end + + it "should set metadata correctly" do + Logit.metadata = { test: "data" } + expect(Logit.metadata).to eql({ test: "data" }) + end + + it "should format :trace level messages with TRACE: label" do + logdev = StringIO.new + Logit.init(logdev) + Logit.level = :trace + Logit.trace("this is a log message") + aggregate_failures do + expect(logdev.string).to_not match(/ANY:/) + expect(logdev.string).to match(/TRACE:/) + end + end end diff -Nru ruby-mixlib-log-1.7.1/spec/spec_helper.rb ruby-mixlib-log-3.0.8/spec/spec_helper.rb --- ruby-mixlib-log-1.7.1/spec/spec_helper.rb 2016-08-21 12:29:42.000000000 +0000 +++ ruby-mixlib-log-3.0.8/spec/spec_helper.rb 2019-12-30 01:02:29.000000000 +0000 @@ -1,7 +1,7 @@ # # Author:: Adam Jacob () # Author:: Christopher Brown () -# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.. +# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ require "mixlib/log" require "mixlib/log/formatter" +RSpec.configure(&:disable_monkey_patching!) + class Logit extend Mixlib::Log end diff -Nru ruby-mixlib-log-1.7.1/VERSION ruby-mixlib-log-3.0.8/VERSION --- ruby-mixlib-log-1.7.1/VERSION 1970-01-01 00:00:00.000000000 +0000 +++ ruby-mixlib-log-3.0.8/VERSION 2019-12-30 01:02:29.000000000 +0000 @@ -0,0 +1 @@ +3.0.8 \ No newline at end of file