cybrid_api_id_ruby 0.127.21 → 0.127.23
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.lock +10 -7
- data/README.md +5 -5
- data/cybrid_api_id_ruby.gemspec +1 -1
- data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
- data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/patch_user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/version.rb +2 -2
- data/lib/cybrid_api_id_ruby.rb +1 -1
- data/spec/api/bank_applications_idp_api_spec.rb +1 -1
- data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
- data/spec/api/organization_applications_idp_api_spec.rb +1 -1
- data/spec/api/users_idp_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/application_idp_model_spec.rb +1 -1
- data/spec/models/application_list_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
- data/spec/models/customer_token_idp_model_spec.rb +1 -1
- data/spec/models/error_response_idp_model_spec.rb +1 -1
- data/spec/models/patch_user_idp_model_spec.rb +1 -1
- data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
- data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
- data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
- data/spec/models/post_user_idp_model_spec.rb +1 -1
- data/spec/models/user_idp_model_spec.rb +1 -1
- data/spec/models/user_list_idp_model_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/cache/ethon-0.18.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/logger-1.7.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/typhoeus-1.6.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/byebug-13.0.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/date-3.5.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-console-0.8.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/psych-5.3.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/stringio-3.2.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/CHANGELOG.md +46 -1
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/README.md +23 -0
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.18.0/ethon.gemspec +37 -0
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/classes.rb +12 -2
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/codes.rb +3 -2
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/options.rb +4 -3
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/callbacks.rb +10 -3
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/informations.rb +3 -0
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/response_callbacks.rb +6 -1
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/loggable.rb +0 -1
- data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/version.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/.document +4 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/.rdoc_options +3 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/BSDL +22 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/COPYING +56 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/README.md +104 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/errors.rb +9 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/formatter.rb +36 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/log_device.rb +265 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/period.rb +47 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/severity.rb +38 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger/version.rb +5 -0
- data/vendor/bundle/ruby/3.3.0/gems/logger-1.7.0/lib/logger.rb +789 -0
- data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/CHANGELOG.md +14 -1
- data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/README.md +2 -2
- data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/version.rb +1 -1
- data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/typhoeus.gemspec +1 -1
- data/vendor/bundle/ruby/3.3.0/specifications/ethon-0.18.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.3.0/specifications/logger-1.7.0.gemspec +22 -0
- data/vendor/bundle/ruby/3.3.0/specifications/{typhoeus-1.5.0.gemspec → typhoeus-1.6.0.gemspec} +5 -5
- metadata +126 -156
- data/vendor/bundle/ruby/3.3.0/cache/ethon-0.15.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/cache/typhoeus-1.5.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/.github/workflows/ruby.yml +0 -41
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/.gitignore +0 -8
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/.rspec +0 -3
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/Gemfile +0 -43
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/Guardfile +0 -10
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/Rakefile +0 -40
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/ethon.gemspec +0 -26
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/benchmarks.rb +0 -104
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/memory_leaks.rb +0 -114
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/perf_spec_helper.rb +0 -37
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/support/memory_test_helpers.rb +0 -76
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/support/os_memory_leak_tracker.rb +0 -48
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/profile/support/ruby_object_leak_tracker.rb +0 -49
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/curl_spec.rb +0 -38
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/callbacks_spec.rb +0 -59
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/debug_info_spec.rb +0 -54
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/features_spec.rb +0 -24
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/form_spec.rb +0 -104
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/header_spec.rb +0 -79
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/custom_spec.rb +0 -177
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/delete_spec.rb +0 -21
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/get_spec.rb +0 -126
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/head_spec.rb +0 -80
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/options_spec.rb +0 -51
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/patch_spec.rb +0 -51
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/post_spec.rb +0 -317
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http/put_spec.rb +0 -168
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/http_spec.rb +0 -64
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/informations_spec.rb +0 -120
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/mirror_spec.rb +0 -47
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/operations_spec.rb +0 -268
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/options_spec.rb +0 -193
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/queryable_spec.rb +0 -235
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/response_callbacks_spec.rb +0 -152
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy/util_spec.rb +0 -28
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/easy_spec.rb +0 -203
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/libc_spec.rb +0 -14
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/loggable_spec.rb +0 -22
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/multi/operations_spec.rb +0 -298
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/multi/options_spec.rb +0 -182
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/multi/stack_spec.rb +0 -80
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/ethon/multi_spec.rb +0 -152
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/spec_helper.rb +0 -28
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/support/localhost_server.rb +0 -95
- data/vendor/bundle/ruby/3.3.0/gems/ethon-0.15.0/spec/support/server.rb +0 -115
- data/vendor/bundle/ruby/3.3.0/specifications/ethon-0.15.0.gemspec +0 -24
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curl.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/constants.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/form_options.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/functions.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/infos.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/messages.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/curls/settings.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/debug_info.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/features.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/form.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/header.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/actionable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/custom.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/delete.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/get.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/head.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/options.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/patch.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/post.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/postable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/put.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http/putable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/http.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/mirror.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/operations.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/options.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/params.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/queryable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy/util.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/easy.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/ethon_error.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/global_init.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/invalid_option.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/invalid_value.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/multi_add.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/multi_fdset.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/multi_remove.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/multi_timeout.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors/select.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/errors.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/libc.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/multi/operations.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/multi/options.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/multi/stack.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon/multi.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{ethon-0.15.0 → ethon-0.18.0}/lib/ethon.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/UPGRADE.md +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/rack/typhoeus/middleware/params_decoder/helper.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/rack/typhoeus/middleware/params_decoder.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/rack/typhoeus.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/adapters/faraday.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/cache/dalli.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/cache/rails.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/cache/redis.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/config.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/easy_factory.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/errors/no_stub.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/errors/typhoeus_error.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/errors.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/expectation.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/addable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/before.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/block_connection.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/cacheable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/memoizable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/queueable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/runnable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra/stubbable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/hydra.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/pool.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/railtie.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/actions.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/before.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/block_connection.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/cacheable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/callbacks.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/marshal.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/memoizable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/operations.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/responseable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/streamable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request/stubbable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/request.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/response/cacheable.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/response/header.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/response/informations.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/response/status.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus/response.rb +0 -0
- /data/vendor/bundle/ruby/3.3.0/gems/{typhoeus-1.5.0 → typhoeus-1.6.0}/lib/typhoeus.rb +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Logger
|
|
2
|
+
|
|
3
|
+
Logger is a simple but powerful logging utility to output messages in your Ruby program.
|
|
4
|
+
|
|
5
|
+
Logger has the following features:
|
|
6
|
+
|
|
7
|
+
* Print messages to different levels such as `info` and `error`
|
|
8
|
+
* Auto-rolling of log files
|
|
9
|
+
* Setting the format of log messages
|
|
10
|
+
* Specifying a program name in conjunction with the message
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Add this line to your application's Gemfile:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
gem 'logger'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
And then execute:
|
|
21
|
+
|
|
22
|
+
$ bundle
|
|
23
|
+
|
|
24
|
+
Or install it yourself as:
|
|
25
|
+
|
|
26
|
+
$ gem install logger
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Simple Example
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
require 'logger'
|
|
34
|
+
|
|
35
|
+
# Create a Logger that prints to STDOUT
|
|
36
|
+
log = Logger.new(STDOUT)
|
|
37
|
+
log.debug("Created Logger")
|
|
38
|
+
|
|
39
|
+
log.info("Program finished")
|
|
40
|
+
|
|
41
|
+
# Create a Logger that prints to STDERR
|
|
42
|
+
error_log = Logger.new(STDERR)
|
|
43
|
+
error_log = error_log.error("fatal error")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
After checking out the repo, run the following to install dependencies.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
$ bin/setup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then, run the tests as:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
$ rake test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To install this gem onto your local machine, run
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
$ rake install
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
To release a new version, update the version number in `lib/logger/version.rb`, and then run
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
$ rake release
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
73
|
+
|
|
74
|
+
## Advanced Development
|
|
75
|
+
|
|
76
|
+
### Run tests of a specific file
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
$ ruby test/logger/test_logger.rb
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Run tests filtering test methods by a name
|
|
83
|
+
|
|
84
|
+
`--name` option is available as:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
$ ruby test/logger/test_logger.rb --name test_lshift
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Publish documents to GitHub Pages
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
$ rake gh-pages
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then, git commit and push the generated HTMLs onto `gh-pages` branch.
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/logger.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
The gem is available as open source under the terms of the [BSD-2-Clause](BSDL).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Logger
|
|
4
|
+
# Default formatter for log messages.
|
|
5
|
+
class Formatter
|
|
6
|
+
Format = "%.1s, [%s #%d] %5s -- %s: %s\n"
|
|
7
|
+
DatetimeFormat = "%Y-%m-%dT%H:%M:%S.%6N"
|
|
8
|
+
|
|
9
|
+
attr_accessor :datetime_format
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@datetime_format = nil
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call(severity, time, progname, msg)
|
|
16
|
+
sprintf(Format, severity, format_datetime(time), Process.pid, severity, progname, msg2str(msg))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def format_datetime(time)
|
|
22
|
+
time.strftime(@datetime_format || DatetimeFormat)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def msg2str(msg)
|
|
26
|
+
case msg
|
|
27
|
+
when ::String
|
|
28
|
+
msg
|
|
29
|
+
when ::Exception
|
|
30
|
+
"#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }"
|
|
31
|
+
else
|
|
32
|
+
msg.inspect
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'period'
|
|
4
|
+
|
|
5
|
+
class Logger
|
|
6
|
+
# Device used for logging messages.
|
|
7
|
+
class LogDevice
|
|
8
|
+
include Period
|
|
9
|
+
|
|
10
|
+
attr_reader :dev
|
|
11
|
+
attr_reader :filename
|
|
12
|
+
include MonitorMixin
|
|
13
|
+
|
|
14
|
+
def initialize(
|
|
15
|
+
log = nil, shift_age: nil, shift_size: nil, shift_period_suffix: nil,
|
|
16
|
+
binmode: false, reraise_write_errors: [], skip_header: false
|
|
17
|
+
)
|
|
18
|
+
@dev = @filename = @shift_age = @shift_size = @shift_period_suffix = nil
|
|
19
|
+
@binmode = binmode
|
|
20
|
+
@reraise_write_errors = reraise_write_errors
|
|
21
|
+
@skip_header = skip_header
|
|
22
|
+
mon_initialize
|
|
23
|
+
set_dev(log)
|
|
24
|
+
set_file(shift_age, shift_size, shift_period_suffix) if @filename
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def write(message)
|
|
28
|
+
handle_write_errors("writing") do
|
|
29
|
+
synchronize do
|
|
30
|
+
if @shift_age and @dev.respond_to?(:stat)
|
|
31
|
+
handle_write_errors("shifting") {check_shift_log}
|
|
32
|
+
end
|
|
33
|
+
handle_write_errors("writing") {@dev.write(message)}
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def close
|
|
39
|
+
begin
|
|
40
|
+
synchronize do
|
|
41
|
+
@dev.close rescue nil
|
|
42
|
+
end
|
|
43
|
+
rescue Exception
|
|
44
|
+
@dev.close rescue nil
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def reopen(log = nil, shift_age: nil, shift_size: nil, shift_period_suffix: nil, binmode: nil)
|
|
49
|
+
# reopen the same filename if no argument, do nothing for IO
|
|
50
|
+
log ||= @filename if @filename
|
|
51
|
+
@binmode = binmode unless binmode.nil?
|
|
52
|
+
if log
|
|
53
|
+
synchronize do
|
|
54
|
+
if @filename and @dev
|
|
55
|
+
@dev.close rescue nil # close only file opened by Logger
|
|
56
|
+
@filename = nil
|
|
57
|
+
end
|
|
58
|
+
set_dev(log)
|
|
59
|
+
set_file(shift_age, shift_size, shift_period_suffix) if @filename
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
self
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
# :stopdoc:
|
|
68
|
+
|
|
69
|
+
MODE = File::WRONLY | File::APPEND
|
|
70
|
+
# TruffleRuby < 24.2 does not have File::SHARE_DELETE
|
|
71
|
+
if File.const_defined? :SHARE_DELETE
|
|
72
|
+
MODE_TO_OPEN = MODE | File::SHARE_DELETE | File::BINARY
|
|
73
|
+
else
|
|
74
|
+
MODE_TO_OPEN = MODE | File::BINARY
|
|
75
|
+
end
|
|
76
|
+
MODE_TO_CREATE = MODE_TO_OPEN | File::CREAT | File::EXCL
|
|
77
|
+
|
|
78
|
+
def set_dev(log)
|
|
79
|
+
if log.respond_to?(:write) and log.respond_to?(:close)
|
|
80
|
+
@dev = log
|
|
81
|
+
if log.respond_to?(:path) and path = log.path
|
|
82
|
+
if File.exist?(path)
|
|
83
|
+
@filename = path
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
@dev = open_logfile(log)
|
|
88
|
+
@filename = log
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def set_file(shift_age, shift_size, shift_period_suffix)
|
|
93
|
+
@shift_age = shift_age || @shift_age || 7
|
|
94
|
+
@shift_size = shift_size || @shift_size || 1048576
|
|
95
|
+
@shift_period_suffix = shift_period_suffix || @shift_period_suffix || '%Y%m%d'
|
|
96
|
+
|
|
97
|
+
unless @shift_age.is_a?(Integer)
|
|
98
|
+
base_time = @dev.respond_to?(:stat) ? @dev.stat.mtime : Time.now
|
|
99
|
+
@next_rotate_time = next_rotate_time(base_time, @shift_age)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if MODE_TO_OPEN == MODE
|
|
104
|
+
def fixup_mode(dev)
|
|
105
|
+
dev
|
|
106
|
+
end
|
|
107
|
+
else
|
|
108
|
+
def fixup_mode(dev)
|
|
109
|
+
return dev if @binmode
|
|
110
|
+
dev.autoclose = false
|
|
111
|
+
old_dev = dev
|
|
112
|
+
dev = File.new(dev.fileno, mode: MODE, path: dev.path)
|
|
113
|
+
old_dev.close
|
|
114
|
+
PathAttr.set_path(dev, filename) if defined?(PathAttr)
|
|
115
|
+
dev
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def open_logfile(filename)
|
|
120
|
+
begin
|
|
121
|
+
dev = File.open(filename, MODE_TO_OPEN)
|
|
122
|
+
rescue Errno::ENOENT
|
|
123
|
+
create_logfile(filename)
|
|
124
|
+
else
|
|
125
|
+
dev = fixup_mode(dev)
|
|
126
|
+
dev.sync = true
|
|
127
|
+
dev.binmode if @binmode
|
|
128
|
+
dev
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def create_logfile(filename)
|
|
133
|
+
begin
|
|
134
|
+
logdev = File.open(filename, MODE_TO_CREATE)
|
|
135
|
+
logdev.flock(File::LOCK_EX)
|
|
136
|
+
logdev = fixup_mode(logdev)
|
|
137
|
+
logdev.sync = true
|
|
138
|
+
logdev.binmode if @binmode
|
|
139
|
+
add_log_header(logdev) unless @skip_header
|
|
140
|
+
logdev.flock(File::LOCK_UN)
|
|
141
|
+
logdev
|
|
142
|
+
rescue Errno::EEXIST
|
|
143
|
+
# file is created by another process
|
|
144
|
+
open_logfile(filename)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def handle_write_errors(mesg)
|
|
149
|
+
yield
|
|
150
|
+
rescue *@reraise_write_errors
|
|
151
|
+
raise
|
|
152
|
+
rescue
|
|
153
|
+
warn("log #{mesg} failed. #{$!}")
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def add_log_header(file)
|
|
157
|
+
file.write(
|
|
158
|
+
"# Logfile created on %s by %s\n" % [Time.now.to_s, Logger::ProgName]
|
|
159
|
+
) if file.size == 0
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def check_shift_log
|
|
163
|
+
if @shift_age.is_a?(Integer)
|
|
164
|
+
# Note: always returns false if '0'.
|
|
165
|
+
if @filename && (@shift_age > 0) && (@dev.stat.size > @shift_size)
|
|
166
|
+
lock_shift_log { shift_log_age }
|
|
167
|
+
end
|
|
168
|
+
else
|
|
169
|
+
now = Time.now
|
|
170
|
+
if now >= @next_rotate_time
|
|
171
|
+
@next_rotate_time = next_rotate_time(now, @shift_age)
|
|
172
|
+
lock_shift_log { shift_log_period(previous_period_end(now, @shift_age)) }
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def lock_shift_log
|
|
178
|
+
retry_limit = 8
|
|
179
|
+
retry_sleep = 0.1
|
|
180
|
+
begin
|
|
181
|
+
File.open(@filename, MODE_TO_OPEN) do |lock|
|
|
182
|
+
lock.flock(File::LOCK_EX) # inter-process locking. will be unlocked at closing file
|
|
183
|
+
if File.identical?(@filename, lock) and File.identical?(lock, @dev)
|
|
184
|
+
yield # log shifting
|
|
185
|
+
else
|
|
186
|
+
# log shifted by another process (i-node before locking and i-node after locking are different)
|
|
187
|
+
@dev.close rescue nil
|
|
188
|
+
@dev = open_logfile(@filename)
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
true
|
|
192
|
+
rescue Errno::ENOENT
|
|
193
|
+
# @filename file would not exist right after #rename and before #create_logfile
|
|
194
|
+
if retry_limit <= 0
|
|
195
|
+
warn("log rotation inter-process lock failed. #{$!}")
|
|
196
|
+
else
|
|
197
|
+
sleep retry_sleep
|
|
198
|
+
retry_limit -= 1
|
|
199
|
+
retry_sleep *= 2
|
|
200
|
+
retry
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
rescue
|
|
204
|
+
warn("log rotation inter-process lock failed. #{$!}")
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def shift_log_age
|
|
208
|
+
(@shift_age-3).downto(0) do |i|
|
|
209
|
+
if FileTest.exist?("#{@filename}.#{i}")
|
|
210
|
+
File.rename("#{@filename}.#{i}", "#{@filename}.#{i+1}")
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
shift_log_file("#{@filename}.0")
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def shift_log_period(period_end)
|
|
217
|
+
suffix = period_end.strftime(@shift_period_suffix)
|
|
218
|
+
age_file = "#{@filename}.#{suffix}"
|
|
219
|
+
if FileTest.exist?(age_file)
|
|
220
|
+
# try to avoid filename crash caused by Timestamp change.
|
|
221
|
+
idx = 0
|
|
222
|
+
# .99 can be overridden; avoid too much file search with 'loop do'
|
|
223
|
+
while idx < 100
|
|
224
|
+
idx += 1
|
|
225
|
+
age_file = "#{@filename}.#{suffix}.#{idx}"
|
|
226
|
+
break unless FileTest.exist?(age_file)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
shift_log_file(age_file)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def shift_log_file(shifted)
|
|
233
|
+
stat = @dev.stat
|
|
234
|
+
@dev.close rescue nil
|
|
235
|
+
File.rename(@filename, shifted)
|
|
236
|
+
@dev = create_logfile(@filename)
|
|
237
|
+
mode, uid, gid = stat.mode, stat.uid, stat.gid
|
|
238
|
+
begin
|
|
239
|
+
@dev.chmod(mode) if mode
|
|
240
|
+
mode = nil
|
|
241
|
+
@dev.chown(uid, gid)
|
|
242
|
+
rescue Errno::EPERM
|
|
243
|
+
if mode
|
|
244
|
+
# failed to chmod, probably nothing can do more.
|
|
245
|
+
elsif uid
|
|
246
|
+
uid = nil
|
|
247
|
+
retry # to change gid only
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
return true
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
File.open(__FILE__) do |f|
|
|
256
|
+
File.new(f.fileno, autoclose: false, path: "").path
|
|
257
|
+
rescue IOError
|
|
258
|
+
module PathAttr # :nodoc:
|
|
259
|
+
attr_reader :path
|
|
260
|
+
|
|
261
|
+
def self.set_path(file, path)
|
|
262
|
+
file.extend(self).instance_variable_set(:@path, path)
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Logger
|
|
4
|
+
module Period
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
SiD = 24 * 60 * 60
|
|
8
|
+
|
|
9
|
+
def next_rotate_time(now, shift_age)
|
|
10
|
+
case shift_age
|
|
11
|
+
when 'daily', :daily
|
|
12
|
+
t = Time.mktime(now.year, now.month, now.mday) + SiD
|
|
13
|
+
when 'weekly', :weekly
|
|
14
|
+
t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday)
|
|
15
|
+
when 'monthly', :monthly
|
|
16
|
+
t = Time.mktime(now.year, now.month, 1) + SiD * 32
|
|
17
|
+
return Time.mktime(t.year, t.month, 1)
|
|
18
|
+
when 'now', 'everytime', :now, :everytime
|
|
19
|
+
return now
|
|
20
|
+
else
|
|
21
|
+
raise ArgumentError, "invalid :shift_age #{shift_age.inspect}, should be daily, weekly, monthly, or everytime"
|
|
22
|
+
end
|
|
23
|
+
if t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
|
|
24
|
+
hour = t.hour
|
|
25
|
+
t = Time.mktime(t.year, t.month, t.mday)
|
|
26
|
+
t += SiD if hour > 12
|
|
27
|
+
end
|
|
28
|
+
t
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def previous_period_end(now, shift_age)
|
|
32
|
+
case shift_age
|
|
33
|
+
when 'daily', :daily
|
|
34
|
+
t = Time.mktime(now.year, now.month, now.mday) - SiD / 2
|
|
35
|
+
when 'weekly', :weekly
|
|
36
|
+
t = Time.mktime(now.year, now.month, now.mday) - (SiD * now.wday + SiD / 2)
|
|
37
|
+
when 'monthly', :monthly
|
|
38
|
+
t = Time.mktime(now.year, now.month, 1) - SiD / 2
|
|
39
|
+
when 'now', 'everytime', :now, :everytime
|
|
40
|
+
return now
|
|
41
|
+
else
|
|
42
|
+
raise ArgumentError, "invalid :shift_age #{shift_age.inspect}, should be daily, weekly, monthly, or everytime"
|
|
43
|
+
end
|
|
44
|
+
Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Logger
|
|
4
|
+
# Logging severity.
|
|
5
|
+
module Severity
|
|
6
|
+
# Low-level information, mostly for developers.
|
|
7
|
+
DEBUG = 0
|
|
8
|
+
# Generic (useful) information about system operation.
|
|
9
|
+
INFO = 1
|
|
10
|
+
# A warning.
|
|
11
|
+
WARN = 2
|
|
12
|
+
# A handleable error condition.
|
|
13
|
+
ERROR = 3
|
|
14
|
+
# An unhandleable error that results in a program crash.
|
|
15
|
+
FATAL = 4
|
|
16
|
+
# An unknown message that should always be logged.
|
|
17
|
+
UNKNOWN = 5
|
|
18
|
+
|
|
19
|
+
LEVELS = {
|
|
20
|
+
"debug" => DEBUG,
|
|
21
|
+
"info" => INFO,
|
|
22
|
+
"warn" => WARN,
|
|
23
|
+
"error" => ERROR,
|
|
24
|
+
"fatal" => FATAL,
|
|
25
|
+
"unknown" => UNKNOWN,
|
|
26
|
+
}
|
|
27
|
+
private_constant :LEVELS
|
|
28
|
+
|
|
29
|
+
def self.coerce(severity)
|
|
30
|
+
if severity.is_a?(Integer)
|
|
31
|
+
severity
|
|
32
|
+
else
|
|
33
|
+
key = severity.to_s.downcase
|
|
34
|
+
LEVELS[key] || raise(ArgumentError, "invalid log level: #{severity}")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|