Граф коммитов

99 Коммитов

Автор SHA1 Сообщение Дата
BurdetteLamar 8d56260910 [ruby/logger] [DOC] Fix broken link
https://github.com/ruby/logger/commit/8c135bce9a
2023-11-07 15:35:37 +09:00
Mike Perham 194520f80e [ruby/logger] Add Logger#with_level{...} for block-scoped log level.
(https://github.com/ruby/logger/pull/85)

* Update lib/logger/severity.rb

https://github.com/ruby/logger/commit/7aabb0b4aa
2023-02-10 01:08:49 +00:00
Nobuyoshi Nakada 3539da64fc
[DOC] Replace the external URIs to docs with rdoc-ref 2022-10-12 12:27:40 +09:00
lijunwei 1e6cdc76e4 [ruby/logger] Fix the Logger::Formatter documentation
https://github.com/ruby/logger/commit/db554fbda7
2022-10-07 19:37:27 +09:00
Burdette Lamar 9639dc91d9 [ruby/logger] [DOC] Enhanced RDoc for Logger (https://github.com/ruby/logger/pull/77)
Enhanced RDoc for Logger

https://github.com/ruby/logger/commit/c601ed0370

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-05-14 05:02:18 +09:00
Burdette Lamar 55ba414405 [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/a5a2f2da4a

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-05-13 22:52:59 +09:00
Burdette Lamar 1f1283b927 [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/e6f2c64fc6

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-05-13 22:52:58 +09:00
Burdette Lamar 45a92cc4fe [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/3dc5a8d7a4

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-05-13 22:52:57 +09:00
Burdette Lamar 00635f8d41 [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/98919e09e5

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-05-13 22:52:56 +09:00
Burdette Lamar 2427a11b35 [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/073a892ad9

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2022-05-13 22:52:55 +09:00
Burdette Lamar b9311e646e [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/6d91281f7f

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2022-05-13 22:52:55 +09:00
Burdette Lamar e36a794f1a [ruby/logger] Update lib/logger.rb
https://github.com/ruby/logger/commit/34c0ba8baa

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2022-05-13 22:52:54 +09:00
BurdetteLamar 90d8b7219e [ruby/logger] Enhanced RDoc for Logger
https://github.com/ruby/logger/commit/16556d06d1
2022-05-13 22:52:53 +09:00
Jesse Chavez 99d02caed3 [ruby/logger] Fix log rotation inter-process lock failed.
Issue only occurs in JRuby 9.3.0.0 and Windows and the full
console output is:

log rotation inter-process lock failed. D:\log.txt -> D:\log.txt.0: The process cannot access the file because it is being used by another process.
log writing failed. closed stream
log writing failed. closed stream
...

https://github.com/ruby/logger/commit/19fc734638
2022-01-27 12:33:06 +09:00
Gannon McGibbon b56c8f814e
[ruby/logger] Replace "iff" with "if and only if"
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.

https://github.com/ruby/logger/commit/4fa0c28e00
2021-04-20 21:19:41 +09:00
Masataka Pocke Kuwabara c1d1f92e8a [ruby/logger] Mention `File::Null` in Logger#new document
https://github.com/ruby/logger/commit/2e772770be
2020-06-11 14:22:32 +09:00
Masataka Pocke Kuwabara c7da0fcb39 [ruby/logger] Mention behavior when logdev is a nil in the document
https://github.com/ruby/logger/commit/8dc270ee23
2020-06-11 14:22:19 +09:00
Lourens Naudé ae93ebae67 [ruby/logger] Let Logger#reopen not raise on nil log devices
https://github.com/ruby/logger/commit/da7bf844e5
2020-06-11 13:54:04 +09:00
Lourens Naudé f3e12caa08 [ruby/logger] Let File::NULL ("/dev/null", "NUL" etc.) be considered a nil log device
https://github.com/ruby/logger/commit/b42a1b99aa
2020-06-11 13:53:50 +09:00
Jeremy Evans 7a1c56f978 [ruby/logger] Document that shift_age of 0 disables log file rotation
Fixes Ruby Bug 16349.

https://github.com/ruby/logger/commit/b1b6d06f2d
2019-12-10 20:59:36 +09:00
George Claghorn eb18cb3e47 [ruby/logger] Honor Logger#level overrides
https://github.com/ruby/logger/commit/7365c995bf
2019-12-10 20:58:25 +09:00
sonots 0aafc32995
[ruby/logger] frozen_string_literal: true
https://github.com/ruby/logger/commit/a057eede7b
2019-12-09 19:17:31 +09:00
Alan Wu 22548195d5
[ruby/logger] Fix typo
https://github.com/ruby/logger/commit/5f70168ac5
2019-12-09 19:17:31 +09:00
Rafael Mendonça França 58065b8701
[ruby/logger] Add option to set the binary mode of the log device
Without binmode strings with incompatible encoding can't be written in
the file. This is very common in applications that log user provided
parameters.

We need to allow changing the binnary mode because right now it is impossible to use
the built-in log rotation feature when you provide a File object to the
LogDevice, and if you provide a filename you can't have binmode.

https://github.com/ruby/logger/commit/9114b3ac7e
2019-07-15 14:43:08 +09:00
Samuel Williams 2c22051b4b
[ruby/logger] Enable `frozen_string_literal: true` in `logger.rb`.
https://github.com/ruby/logger/commit/2dc832e901
2019-07-15 14:43:08 +09:00
Samuel Williams 3fdb963827
[ruby/logger] Prefer require_relative, it's a little bit faster.
https://github.com/ruby/logger/commit/1e2aab4bea
2019-07-15 14:43:07 +09:00
sonots 7f10da9d27
[ruby/logger] require 'logger/errors' just for compat
https://github.com/ruby/logger/commit/255a51dc10
2019-07-15 14:43:07 +09:00
Colby Swandale bbe157f340
[ruby/logger] split logger classes/modules into separate files
https://github.com/ruby/logger/commit/f10ce9fff2
2019-07-15 14:43:07 +09:00
Samuel Williams 47500f2055
[ruby/logger] Add support for changing severity using bang methods.
https://github.com/ruby/logger/commit/ae4c6dfcbb
2019-07-15 14:43:07 +09:00
hsbt dd046c59de Bump version to 1.3.0 same as the latest version of rubygems.org.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-12 09:40:06 +00:00
tenderlove 655b3da03c Fixes the File::CREAT logger documentation
Co-Authored-By: Matias Korhonen <matias@kiskolabs.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25 18:04:16 +00:00
normal f729089f44 logger: use safe navigation operator
Saves a few hundred bytes of bytecode in a frequently loaded module.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 00:52:01 +00:00
sonots 7176eb2df9 * lib/logger.rb (Logger::LogDevice#open_logfile, #create_logfile):
Logger should be able to open only files [Bug #14212]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-21 05:07:43 +00:00
sonots 93fe0ff2f1 logger.rb: Fix handling progname
Because progname was memoized with ||= a logger call that involved
outputting false would be nil. Example code:

  logger = Logger.new(STDOUT)
  logger.info(false)  # => nil

Perform an explicit nil check instead of ||= so that false will be output.

patched by Gavin Miller <gavingmiller@gmail.com> [Fix GH-1667]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-20 16:47:26 +00:00
normal 7142f5b595 logger: remove redundant opt_str_freeze use
Strings in "when" statements are allocation-free, so there's
never any reason to uglify the code to use opt_str_freeze over
the normal putobject instructions, here.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-24 07:29:33 +00:00
nobu f6e77b9d35 logger.rb: fix next rotate time
* lib/logger.rb (Logger::LogDevice#initialize): calculate next
  rotate time based on the mtime of the last existing file.
  [ruby-dev:49881] [Bug #12948]

Author: Tsukasa Oishi <tsukasa.oishi@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-16 06:59:42 +00:00
hsbt 990b23bbbc * lib/logger.rb: Improve Logger.new option documentation.
[Feature #12803][ruby-core:77467]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14 09:01:01 +00:00
nobu 8fc170a34e logger: fix monthly log rotate with DST
* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
  rotate when DST is applied during a month of 31 days.
  [Fix GH-1458]

With DST the month of october can actually last more than 31 days.
It can last 31 days plus 1 hour. So during october, `t` used to be
equal to "2016-10-31 23:00:00" instead of "2016-11-01 00:00:00".
This was then normalized to "2016-10-01 00:00:00" which lead every
single line of log during october to rotate the log file.
This fix ensure that next_rotate_time(now, 'monthly') always return
the first day of next month in every situation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-08 00:06:57 +00:00
kazu 81ac73c04d [DOC] Fix default value of shift_age [ci skip]
`LogDevice#initialize` treats shift_age: nil as 7, but
Logger#initialize has the default value of shift_age as 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03 12:21:14 +00:00
sonots 2c6f15b1ad * lib/logger.rb: Add shift_period_suffix option [Fix GH-10772]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 15:07:31 +00:00
sonots a040953386 Allow specifying logger parameters in constructor
* lib/logger.rb: Allow specifying logger prameters such as level,
  progname, datetime_format, formatter in constructor [Bug #12224]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 10:45:40 +00:00
nobu 84d818678f Logger: simple refactoring
* lib/logger.rb (Logger#level=): remove unnecessary local
  variable.
* lib/logger.rb (Logger#initialize, Logger#reopen): [DOC] mention
  the default values.  cherrypicked from [GH-1319].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06 01:56:16 +00:00
nobu a435fae7bd logger.rb: kwd args
* lib/logger.rb (Logger::LogDevice#initialize): define using
  keyword arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-08 15:07:05 +00:00
sonots 460e9d8d83 * lib/logger.rb: Remove block from Logger.add as it's not needed
patch provided by Daniel Lobato Garcí [fix GH-1240] [Bug #12054]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09 07:41:51 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
sonots 8594cab140 * lib/logger.rb: expose logger mutex
[fix GH-541] Patch by @arthurnn

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-20 14:16:56 +00:00
sonots 398abe4c51 * lib/logger.rb: support symbol and string log level setting
[fix GH-1101]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 14:15:25 +00:00
sonots f952570bdd lib/logger.rb: Add Logger#reopen
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 13:58:57 +00:00
nobu 6df21cb469 logger.rb: end of week should be Saturday
* lib/logger.rb (Logger::Period#previous_period_end): as weekly
  rotation shifts the log file on Sundays, the end date of the
  previous period should be Saturdays.  fix r45072.
  [ruby-dev:49314] [Bug #11622]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-27 07:18:14 +00:00
nobu e8c00b7027 logger.rb: fix weekly rotation
* lib/logger.rb (Logger::Period#next_rotate_time): get rid of
  adding to mday not to exceed the days of the month.
  [ruby-core:71185] [Bug #11620]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-27 03:00:38 +00:00