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

47 Коммитов

Автор SHA1 Сообщение Дата
Baron Bloomer 4375546810
[ruby/logger] Test cases
https://github.com/ruby/logger/commit/40adb645e2
2021-12-18 08:38:58 +09:00
Hiroshi SHIBATA 8f6b42e0cb
[ruby/logger] Ignored loading CoreAssertions in test runner
https://github.com/ruby/logger/commit/2fd5401ad6
2021-09-15 08:49:24 +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
George Claghorn eb18cb3e47 [ruby/logger] Honor Logger#level overrides
https://github.com/ruby/logger/commit/7365c995bf
2019-12-10 20:58:25 +09:00
Hiroshi SHIBATA 1b59ed9b49
Move helper file of logger to under the test/logger. 2019-07-15 14:43:08 +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
sonots 136196785b
[ruby/logger] Fix to use logger and test-unit in this repo with
`ruby test/logger/test_xxx.rb`

https://github.com/ruby/logger/commit/d3c2402340
2019-07-15 14:43:07 +09:00
k0kubun f5fc032eee Remove unused variables
This fixes following warning:

```
test/logger/test_logger.rb:329: warning: assigned but unused variable - read_read
```

[Fix GH-1840]

From: yuuji.yaginuma <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:41:35 +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
nobu a2f3069988 test_logger.rb: suppress a warning
* test/logger/test_logger.rb (test_datetime_format): suppress
  warning when strftime called with empty format string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 02:39:09 +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
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 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 e00bcd1df3 test/logger: split
* test/logger: split for each test cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 07:04:25 +00:00
hsbt 72191a0acd * test/net/ftp/test_ftp.rb: remove unused variables.
test/logger/test_logger.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 06:05:52 +00:00
nobu 0e52301c4b test_logger.rb: fix system dependent test
* test/logger/test_logger.rb (test_shifting_size_not_rotate_too_much):
  useless test on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-15 09:25:05 +00:00
nobu 95ed081663 logger.rb: fix extra log ratation
* 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
2013-12-14 05:43:01 +00:00
nobu 74f424c26a test_logger.rb: clear garbage files
* test/logger/test_logger.rb (test_shifting_age_in_multiprocess):
  unlink rotated log files all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-07 18:11:38 +00:00
nobu 3c8072937c logger.rb: fix r43511 for Windows
* 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
2013-11-02 06:15:02 +00:00
naruse 0749adc54c * lib/logger.rb: Inter-process locking for log rotation
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
2013-11-01 22:14:42 +00:00
akr 8f671120f1 * test/csv/test_features.rb, test/logger/test_logger.rb
test/mkmf/test_have_macro.rb, test/net/http/test_http.rb,
  test/openssl/test_config.rb, test/psych/test_encoding.rb,
  test/psych/test_exception.rb, test/psych/test_psych.rb,
  test/psych/test_tainted.rb, test/readline/test_readline.rb,
  test/rexml/test_contrib.rb, test/ruby/test_autoload.rb,
  test/ruby/test_beginendblock.rb, test/ruby/test_exception.rb,
  test/ruby/test_file.rb, test/ruby/test_io.rb,
  test/ruby/test_marshal.rb, test/ruby/test_process.rb,
  test/ruby/test_require.rb, test/ruby/test_rubyoptions.rb,
  test/syslog/test_syslog_logger.rb, test/webrick/test_httpauth.rb,
  test/zlib/test_zlib.rb: Use Tempfile.create.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20 23:03:52 +00:00
akr 052c0e67d9 * test/ruby/test_require.rb: Remove temporally files in the tests.
* test/ruby/test_rubyoptions.rb: Ditto.

* test/logger/test_logger.rb: Ditto.

* test/psych/test_psych.rb: Ditto.

* test/readline/test_readline.rb: Ditto.

* test/syslog/test_syslog_logger.rb: Ditto.

* test/webrick/test_httpauth.rb: Ditto.

* test/zlib/test_zlib.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 02:06:32 +00:00
nobu 51e5863aa8 test_logger.rb: uset tmpfile
* test/logger/test_logger.rb (TestLogDevice#test_shifting_size):
  should not create working file in the current directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-20 13:25:58 +00:00
naruse 58ef0f06c6 * ruby.c (load_file_internal): set default source encoding as
UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]

* parse.y (parser_initialize): set default parser encoding as
  UTF-8 instead of US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 00:49:57 +00:00
nobu a0d2cd2e1e test: why believe source directories are writable always?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-08 06:49:59 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
usa a8f8b617c0 * test/logger/test_logger.rb: close logger (or logdevice) if it's related to
a file because some platforms such as Windows cannot remove opened files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 03:05:05 +00:00
nobu f04debed3b * test/logger/test_logger.rb (TestLogDevice#test_write): check
also error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 23:17:19 +00:00
nahi 8906bf2c1b * lib/logger.rb: imported upstream version (logger/1.2.7) see #2238.
* do not raise an exception even if log writing failed.
          * do not raise ShiftingError if an aged file already exists.
            (no ShiftingError will be raised from 1.2.7, just warn() instead)
        * test/logger/test_logger.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 15:08:38 +00:00
nobu b7ac5b1262 * lib/logger.rb (ProgName): fixed for svn, based on a patch from
Nobuhiro IMAI at [ruby-dev:37108].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-18 07:18:29 +00:00
nobu 00b4a3f9c4 * test: assert_raises has been deprecated since a long time ago.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 17:44:39 +00:00
naruse b97ec5d0c0 * lib/rexml/text.rb, lib/rubygems/open-uri.rb, lib/open-uri.rb,
test/logger/test_logger.rb, test/ruby/test_regexp.rb:
  fix tests. [ruby-dev:33336]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 18:53:52 +00:00
gotoyuzo f9b894273f * test/logger/test_logger.rb: Module#constants returns an array of Symbols.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 14:35:41 +00:00
nahi 8b02984629 * test/logger/test_logger.rb: unintentionally overwritten changes by
Usa.  reverted.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-15 15:17:53 +00:00
nahi 6b1239a820 * lib/logger.rb (Logger): added formatter accessor to logger for
dictating the way in which the logger should format the messages it
          displays.  Thanks to Nicholas Seckar (cf. [ruby-talk:153391]) and
          Daniel Berger.

        * lib/logger.rb (Logger): added VERSION constant.

        * lib/logger.rb: removed document for LogDevice. It is an
          implementation detail and is not a public interface.

        * test/logger/test_logger.rb: added tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-13 13:13:41 +00:00
usa 08324a4098 * test/logger/test_logger.rb (test_shifting_size): should close log
device before unlink, since some platform cannot unlink opened
  file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-24 02:02:16 +00:00
nahi f003069ecd * lib/logger.rb (write, shift_log?, shift_log): file shifting race
condition bug fixed.  [ruby-dev:26764]

        * test/logger/test_logger.rb: tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-20 13:43:46 +00:00
matz 70bbad3cfd * array.c: replace rb_protect_inspect() and rb_inspecting_p() by
rb_exec_recursive() in eval.c.

* eval.c (rb_exec_recursive): new function.

* array.c (rb_ary_join): use rb_exec_recursive().

* array.c (rb_ary_inspect, rb_ary_hash): ditto.

* file.c (rb_file_join): ditto.

* hash.c (rb_hash_inspect, rb_hash_to_s, rb_hash_hash): ditto.

* io.c (rb_io_puts): ditto.

* object.c (rb_obj_inspect): ditto

* struct.c (rb_struct_inspect): ditto.

* lib/set.rb (SortedSet::setup): a hack to shut up warning.
  [ruby-talk:132866]

* lib/time.rb (Time::strptime): add new function.  inspired by
  [ruby-talk:132815].

* lib/parsedate.rb (ParseDate::strptime): ditto.

* regparse.c: move st_*_strend() functions from st.c.  fixed some
  potential memory leaks.

* exception error messages updated.  [ruby-core:04497]

* ext/socket/socket.c (Init_socket): add bunch of Socket
  constants.  Patch from Sam Roberts <sroberts@uniserve.com>.
  [ruby-core:04409]

* array.c (rb_ary_s_create): no need for negative argc check.
  [ruby-core:04463]

* array.c (rb_ary_unshift_m): ditto.

* lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass
  of StandardError class, not Exception class.  [ruby-core:04429]

* parse.y (fcall_gen): lvar(arg) will be evaluated as
  lvar.call(arg) when lvar is a defined local variable. [new]

* object.c (rb_class_initialize): call inherited method before
  calling initializing block.

* eval.c (rb_thread_start_1): initialize newly pushed frame.

* lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE.
  fixed: [ruby-core:04444]

* eval.c (is_defined): NODE_IASGN is an assignment.

* ext/readline/readline.c (Readline.readline): use rl_outstream
  and rl_instream.  [ruby-dev:25699]

* ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check
  [ruby-dev:25675]

* misc/ruby-mode.el: [ruby-core:04415]

* lib/rdoc/generators/html_generator.rb: [ruby-core:04412]

* lib/rdoc/generators/ri_generator.rb: ditto.

* struct.c (make_struct): fixed: [ruby-core:04402]

* ext/curses/curses.c (window_color_set): [ruby-core:04393]

* ext/socket/socket.c (Init_socket): SO_REUSEPORT added.
  [ruby-talk:130092]

* object.c: [ruby-doc:818]

* parse.y (open_args): fix too verbose warnings for the space
  before argument parentheses.  [ruby-dev:25492]

* parse.y (parser_yylex): ditto.

* parse.y (parser_yylex): the first expression in the parentheses
  should not be a command.  [ruby-dev:25492]

* lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]

* object.c (Init_Object): remove Object#type.  [ruby-core:04335]

* st.c (st_foreach): report success/failure by return value.
  [ruby-Bugs-1396]

* parse.y: forgot to initialize parser struct.  [ruby-dev:25492]

* parse.y (parser_yylex): no tLABEL on EXPR_BEG.
  [ruby-talk:127711]

* document updates - [ruby-core:04296], [ruby-core:04301],
  [ruby-core:04302], [ruby-core:04307]

* dir.c (rb_push_glob): should work for NUL delimited patterns.

* dir.c (rb_glob2): should aware of offset in the pattern.

* string.c (rb_str_new4): should propagate taintedness.

* env.h: rename member names in struct FRAME; last_func -> callee,
  orig_func -> this_func, last_class -> this_class.

* struct.c (rb_struct_set): use original method name, not callee
  name, to retrieve member slot.  [ruby-core:04268]

* time.c (time_strftime): protect from format modification from GC
  finalizers.

* object.c (Init_Object): remove rb_obj_id_obsolete()

* eval.c (rb_mod_define_method): incomplete subclass check.
  [ruby-dev:25464]

* gc.c (rb_data_object_alloc): klass may be NULL.
  [ruby-list:40498]

* bignum.c (rb_big_rand): should return positive random number.
  [ruby-dev:25401]

* bignum.c (rb_big_rand): do not use rb_big_modulo to generate
  random bignums.  [ruby-dev:25396]

* variable.c (rb_autoload): [ruby-dev:25373]

* eval.c (svalue_to_avalue): [ruby-dev:25366]

* string.c (rb_str_justify): [ruby-dev:25367]

* io.c (rb_f_select): [ruby-dev:25312]

* ext/socket/socket.c (sock_s_getservbyport): [ruby-talk:124072]

* struct.c (make_struct): [ruby-dev:25249]

* dir.c (dir_open_dir): new function.  [ruby-dev:25242]

* io.c (rb_f_open): add type check for return value from to_open.

* lib/pstore.rb (PStore#transaction): Use the empty content when a
  file is not found.  [ruby-dev:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-04 06:47:45 +00:00
nahi 12c788d061 Sun Nov 14 08:46:33 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/logger/test_logger.rb: Logger just expects
          Logger#datetime_format to be used for Time#strftime independently of
          locale. [ruby-dev:24828]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-13 23:50:46 +00:00
nahi 77cb3aeba1 * lib/logger.rb(Logger#msg2str): no special treatment for the object
which responds to :to_str.

        * lib/logger.rb(LogDevice#initialize): remove type checking if the
          given object is a String.  Kernel.open handles it correctly.

        * test/logger/test_logger.rb: follow above change (ArgumentError ->
          TypeError.)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-06 11:55:08 +00:00
nahi 637af54751 * test/logger/test_logger.rb: unlinking file before close causes problem under
win32 box.

* lib/xsd/datatypes.rb(XSDFloat, XSDDouble): add +/- sign explicitly when
  stringified and embedded into XML instance.  Ruby's sprintf may format -0.0
  as "0.0" (no minus sign) depending on underlying C sprintf implementation.

* test/xsd/test_xsd.rb, test/soap/test_basetype.rb: follow above change.

* test/soap/calc/*: give httpd config param "CGIInterpreter".
  "/usr/bin/env ruby" thing does not work under non-Unix boxes.

* ChangeLog: corrected wrong DoW of my log entries...


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-01 15:29:43 +00:00
nahi 523cd7be9c * lib/logger.rb: check if the given logdevice object respond_to :write and
:close, not is_a? IO.  duck duck.

* test/logger/test_logger.rb: self IO.pipe reading/writing may be locked by the
  flood.  use tempfile.

* lib/wsdl/xmlSchema/data.rb: wrong constant reference.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-29 07:27:57 +00:00
nahi 406fd7754e * lib/logger.rb: add Logger#<<(msg) for writing msg without any formatting.
* test/logger/test_logger.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-23 14:12:42 +00:00
nahi 879944aa32 * reduce expecting size of backtrace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-20 02:54:52 +00:00
nahi deb2caf4b5 * lib/logger.rb: typo fixed.
* test/logger/test_logger.rb: new file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-20 02:51:06 +00:00