aboutsummaryrefslogtreecommitdiffstats
path: root/lib/logger.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/logger] Mention `File::Null` in Logger#new documentMasataka Pocke Kuwabara2020-06-111-1/+2
| | | | https://github.com/ruby/logger/commit/2e772770be
* [ruby/logger] Mention behavior when logdev is a nil in the documentMasataka Pocke Kuwabara2020-06-111-2/+2
| | | | https://github.com/ruby/logger/commit/8dc270ee23
* [ruby/logger] Let Logger#reopen not raise on nil log devicesLourens Naudé2020-06-111-1/+1
| | | | https://github.com/ruby/logger/commit/da7bf844e5
* [ruby/logger] Let File::NULL ("/dev/null", "NUL" etc.) be considered a nil ↵Lourens Naudé2020-06-111-1/+1
| | | | | | log device https://github.com/ruby/logger/commit/b42a1b99aa
* [ruby/logger] Document that shift_age of 0 disables log file rotationJeremy Evans2019-12-101-3/+4
| | | | | | Fixes Ruby Bug 16349. https://github.com/ruby/logger/commit/b1b6d06f2d
* [ruby/logger] Honor Logger#level overridesGeorge Claghorn2019-12-101-6/+6
| | | | https://github.com/ruby/logger/commit/7365c995bf
* [ruby/logger] frozen_string_literal: truesonots2019-12-091-2/+2
| | | | https://github.com/ruby/logger/commit/a057eede7b
* [ruby/logger] Fix typoAlan Wu2019-12-091-1/+1
| | | | https://github.com/ruby/logger/commit/5f70168ac5
* [ruby/logger] Add option to set the binary mode of the log deviceRafael Mendonça França2019-07-151-4/+7
| | | | | | | | | | | | 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
* [ruby/logger] Enable `frozen_string_literal: true` in `logger.rb`.Samuel Williams2019-07-151-1/+1
| | | | https://github.com/ruby/logger/commit/2dc832e901
* [ruby/logger] Prefer require_relative, it's a little bit faster.Samuel Williams2019-07-151-5/+6
| | | | https://github.com/ruby/logger/commit/1e2aab4bea
* [ruby/logger] require 'logger/errors' just for compatsonots2019-07-151-0/+1
| | | | https://github.com/ruby/logger/commit/255a51dc10
* [ruby/logger] split logger classes/modules into separate filesColby Swandale2019-07-151-291/+4
| | | | https://github.com/ruby/logger/commit/f10ce9fff2
* [ruby/logger] Add support for changing severity using bang methods.Samuel Williams2019-07-151-0/+15
| | | | https://github.com/ruby/logger/commit/ae4c6dfcbb
* Bump version to 1.3.0 same as the latest version of rubygems.org.hsbt2018-12-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixes the File::CREAT logger documentationtenderlove2018-07-251-1/+1
| | | | | | 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
* logger: use safe navigation operatornormal2018-01-181-4/+2
| | | | | | 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
* * lib/logger.rb (Logger::LogDevice#open_logfile, #create_logfile):sonots2017-12-211-2/+2
| | | | | | 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
* logger.rb: Fix handling prognamesonots2017-07-201-1/+3
| | | | | | | | | | | | | | 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
* logger: remove redundant opt_str_freeze usenormal2017-03-241-6/+6
| | | | | | | | 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
* logger.rb: fix next rotate timenobu2016-11-161-1/+5
| | | | | | | | | | * 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
* * lib/logger.rb: Improve Logger.new option documentation.hsbt2016-10-141-2/+2
| | | | | | [Feature #12803][ruby-core:77467] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger: fix monthly log rotate with DSTnobu2016-10-081-2/+2
| | | | | | | | | | | | | | | | * 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
* [DOC] Fix default value of shift_age [ci skip]kazu2016-10-031-1/+1
| | | | | | | `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
* * lib/logger.rb: Add shift_period_suffix option [Fix GH-10772]sonots2016-04-181-7/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Allow specifying logger parameters in constructorsonots2016-04-181-4/+34
| | | | | | | * 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
* Logger: simple refactoringnobu2016-04-061-5/+6
| | | | | | | | | * 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
* logger.rb: kwd argsnobu2016-03-081-3/+3
| | | | | | | * 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
* * lib/logger.rb: Remove block from Logger.add as it's not neededsonots2016-02-091-1/+1
| | | | | | 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
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* * lib/logger.rb: expose logger mutexsonots2015-11-201-8/+5
| | | | | | [fix GH-541] Patch by @arthurnn git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb: support symbol and string log level settingsonots2015-11-171-1/+35
| | | | | | [fix GH-1101] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/logger.rb: Add Logger#reopensonots2015-11-171-6/+47
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: end of week should be Saturdaynobu2015-10-271-1/+1
| | | | | | | | | * 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
* logger.rb: fix weekly rotationnobu2015-10-271-3/+5
| | | | | | | | * 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
* logger.rb: exact matchingnobu2015-10-261-6/+6
| | | | | | | * lib/logger.rb ({next,previous}_rotate_time): dispatch by exact matching shift_age instead of regexp matching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: freeze constantsnobu2015-10-261-3/+3
| | | | | | * lib/logger.rb: freeze constant strings and array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: simplifynobu2014-08-251-5/+1
| | | | | | | * lib/logger.rb (format_datetime): simplify and freeze the default format so that it can be shared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/logger.rb: use %Nnobu2014-08-251-1/+1
| | | | | | | * lib/logger.rb (format_datetime): use "%6N" to show microsecond. [Fix GH-704] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * logger.rb: removed unmaintain code.hsbt2014-07-021-123/+0
| | | | | | | [Feature #9860][ruby-core:62724] * test/logger/test_application.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/gserver.rb: remove redundant use of to_s in interpolation.hsbt2014-06-241-1/+1
| | | | | | | | | | * lib/logger.rb: ditto. * lib/optparse.rb: ditto. * lib/rbconfig/obsolete.rb: ditto. * lib/resolv.rb: ditto. * lib/webrick/httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb: refactored to include Logger::Period.hsbt2014-05-241-43/+39
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: DSTnobu2014-02-211-10/+7
| | | | | | | * lib/logger.rb (next_rotate_time, previous_period_end): consider DST change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: fix midnight log rotation missnobu2014-02-211-7/+34
| | | | | | | | | | * lib/logger.rb (Logger::LogDevice#check_shift_log): compare the current time with the time for the next rotation to fix rotation miss when date changed between the comparison and log writing. based on the patch by megayu <yuhg2310 AT gmail.com>. [Fixes GH-539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb: [DOC] Fix arg name for Logger.new by @ryotarai [ci skip] ↵hsbt2014-02-111-2/+2
| | | | | | [fix GH-531] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: fix extra log ratationnobu2013-12-141-2/+1
| | | | | | | | * lib/logger.rb (lock_shift_log): no need to rotate the log file if it has been rotated by another process. based on the patch by no6v (Nobuhiro IMAI) in [ruby-core:58620]. [Bug #9133] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* logger.rb: fix r43511 for Windowsnobu2013-11-021-2/+6
| | | | | | | | | | * lib/logger.rb (Logger::LogDevice::LogDeviceMutex#lock_shift_log): open file can't be removed or renamed on Windows. [ruby-dev:47790] [Bug #9046] * test/logger/test_logger.rb (TestLogDevice#run_children): don't use fork. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb: Inter-process locking for log rotationnaruse2013-11-011-8/+49
| | | | | | | | Current implementation fails log rotation on multi process env. by sonots <sonots@gmail.com> https://github.com/ruby/ruby/pull/428 fix GH-428 [Bug #9046] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb: Use :call-seq: for method signature rdoczzak2013-07-101-6/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/logger.rb (#add): Remove incorrect rdoc for return valuezzak2013-07-101-2/+0
| | | | | | | [Bug #8567] Reported by Tim Pease. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e