Commit Graph

59 Commits

Author SHA1 Message Date
tocariimaa
d51d88700b Implement removeHandler in std/logging module (fixes #23757) (#24143)
Since the module allows for a handler to be added multiple times, for
the sake of consistency, `removeHandler` only removes the first found
instance of the handler in the `handlers` seq. So for n calls of
`addHandler` using the same handler, n calls of `removeHandler` are
required.

fixes #23757

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2024-09-20 17:32:23 +02:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
Andrey Makarov
a660c17d30 Markdown code blocks migration part 8 (#22478) 2023-08-15 06:27:36 +02:00
Matt Haggard
1daf43fb14 Allow users to set log flushing rules (#20817)
* Add flushThreshold to std/logging loggers

* Remove duplicate field

* Add -d:nimFlushAllLogs for changing default flush behavior globally

* Add changelog entry for log flushing change

* Flush all log levels by default in Nim v2
2022-11-14 16:00:45 +01:00
ee7
e8657c7107 make implicit cstring conversions explicit (#19488)
The Nim manual says that an implicit conversion to cstring will
eventually not be allowed [1]:

    A Nim `string` is implicitly convertible to `cstring` for convenience.

    [...]

    Even though the conversion is implicit, it is not *safe*: The garbage collector
    does not consider a `cstring` to be a root and may collect the underlying
    memory. For this reason, the implicit conversion will be removed in future
    releases of the Nim compiler. Certain idioms like conversion of a `const` string
    to `cstring` are safe and will remain to be allowed.

And from Nim 1.6.0, such a conversion triggers a warning [2]:

    A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning.
    This warning will become an error in future versions! Use an explicit conversion
    like `cstring(x)` in order to silence the warning.

However, some files in this repo produced such a warning. For example,
before this commit, compiling `parsejson.nim` would produce:

    /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]
    /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]

This commit resolves the most visible `CStringConv` warnings, making the
cstring conversions explicit.

[1] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/doc/manual.md#cstring-type
[2] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/changelogs/changelog_1_6_0.md#type-system
2022-08-19 15:40:53 -04:00
flywind
891329cd4b move io out of system (#19442)
* move io out of system

* fix tests

* fix tests

* next step

* rename to syncio

* rename

* fix nimscript

* comma

* fix

* fix parts of errors

* good for now

* fix test
2022-02-02 17:10:11 +01:00
konsumlamm
9819fb21d8 Use .. warning:: (#17320) 2021-03-10 10:39:23 -08:00
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
Elliot Waite
f3d57761ab Fix broken links in docs (#16336)
* Fix broken links in docs

* Fix rand HSlice links
2020-12-14 20:13:12 +01:00
Hendrik
9ed0dbfa6e fix index error (#14974)
Co-authored-by: Hendrik Albers <mail@hendrik.dev>
2020-07-14 13:15:22 +02:00
Juan Carlos
21b3ca636f Fix logging tiny bug (#14910)
* Fix logging tiny bug

* Update changelog.md

Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>

* Update changelog.md

Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>

* Update changelog.md

Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>

* https://github.com/nim-lang/Nim/pull/14910#discussion_r450012032

Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>
2020-07-06 04:00:25 -04:00
narimiran
5732bb41ef [backport] run nimpretty on the remaining files 2019-09-30 13:58:17 +02:00
Zachary Carter
082c440f13 Fixes effect error in pure/logging.nim (#11898)
* Fix effect error in pure/logging.nim

Currently calling `logging.log` will produce - `Error: can have an unlisted effect: RootEffect`. Add `RootEffect` to list of tags.

* the only tag necessary is RootEffect since all other Effects are descendants of RootEffect
2019-08-08 22:48:25 +02:00
Jjp137
b0e236674c logging: better documentation (#10895) 2019-03-24 18:53:04 +01:00
Istvan
915a9ec082 Adding more documentation to logging.nim
Just minor addition to the documentation with the use of operators
2018-12-17 19:29:08 +01:00
Ahmed T. Youssef
df68c2da49 write logs to stderr instead of stdout; fixes #9547 (#9554) 2018-10-30 07:36:31 +01:00
Araq
64517445ea even more strict isNil handling for strings/seqs in order to detect bugs 2018-08-22 12:35:46 +02:00
Araq
bbb0fd4eb7 remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
Andreas Rumpf
83d4a025e2 make logging module compile again 2018-04-30 01:30:23 +02:00
Yuriy Glukhov
852e1d3da1 logging: don't crash on nil strings 2018-01-11 11:50:13 +02:00
skilchen
28e0bf9dcd fix #6264 and #6141 (#6884) 2017-12-11 14:43:59 +01:00
Anatoly Galiulin
0874c649e9 Fix console logger issue; fixes #5546 (#5547) 2017-03-16 20:25:53 +01:00
Ruslan Mustakov
2096d399b1 Explicitly mark log() method as gcsafe 2017-02-27 16:40:43 +07:00
Federico Ceratto
469a7d258c Add warning about log flushing. Related to #3269 (#5424) 2017-02-24 15:58:02 +01:00
Dmitry Polienko
2c46fdd0ab Add newFileLogger overload accepting file descriptor 2016-11-15 12:13:05 +07:00
Yuriy Glukhov
a994f142b5 Enabled logging tests for js 2016-09-03 22:46:10 +03:00
Yuriy Glukhov
c43a7f3980 Logging compatible with js 2016-09-03 21:11:10 +03:00
Andreas Rumpf
0834cd63d9 prepare Nim codebase for upcoming parser changes 2016-07-15 12:56:03 +02:00
niv
5da7f28990 pure/logging: add notice level, suggest usecases 2016-05-01 12:51:36 +02:00
Bruce Doan
3b0d8fbea4 respect global log filter level 2015-11-28 16:41:07 +07:00
Araq
c7a3079123 logging.nim: expose underlying 'file' object; errors and fatals flush the buffer; refs #3270 2015-10-12 21:08:44 +02:00
Federico Ceratto
08ec0ce071 Add substituteLog docs 2015-10-09 23:26:22 +01:00
Federico Ceratto
6823a60b23 Export substituteLog
Allow Nim users to create their own loggers
2015-10-09 18:34:58 +01:00
patrick dw
15e7fe787a renamed writeln to writeLine in lib 2015-06-19 01:02:22 -05:00
Sergey Avseyev
0fe54a5e14 Fix logger formatting
Motivation
----------
Current implementation does not allow to specify any formatting. It
even cannot output log level, because `writeln()` accepts
`varags[string]` and silently ignores everything before last argument.

Modification
------------
Perform formatting in the single place during substitution. Make log
level optional as all other substitution variables. Also make verbose
logging more informative and parseable.

Result
------
Correct handling formatting and substitutions. Machine-friendly default
output of verbose logger.
2015-06-13 14:41:08 +03:00
Dominik Picheta
88e849078f Merge pull request #2830 from yglukhov/logging-no-format
Removed formatting from logging.
2015-06-04 11:43:49 +01:00
x2f
51d284ce84 Documented bufSize param in logging.nim
Documented bufSize param in logging.nim to complete the previous change
that added a bufSize parameter to file based logger constructors.
2015-06-01 21:52:26 -04:00
x2f
3f78f75483 Expose bufSize parameter for file-based loggers
newFileLogger and newRollingFileLogger have a new bufSize parameter that
is used in open(). The default value -1 has the same behavior as before.
Use 0 for unbuffered output to log file.
2015-05-31 21:06:23 -04:00
yglukhov
e65ccfb8f5 Removed formatting from logging. 2015-05-28 14:48:53 +03:00
Frank Fischer
749e808e1e logging: make fmtStr public to be used in user defined loggers 2015-05-11 23:29:51 +02:00
Oleh Prypin
32109a7867 Don't run non-test code when defined(testing) 2015-04-21 14:37:29 +03:00
def
64903e7050 Use ^ instead of - in slices 2015-03-28 00:38:15 +01:00
teroz
8132723317 fixed log*(logger: RollingFileLogger, level: Level,
frmt: string, args: varargs[string, ])
2015-03-13 12:05:02 +02:00
Federico Ceratto
657dca5c3b Fix typos 2015-02-15 16:20:32 +00:00
Fabio Cevasco
99b14c8d8d newRollingFileLogger - fmtStr is always set to defaultFmtStr 2015-02-06 22:40:21 +01:00
Dominik Picheta
defaf5d400 Logging module is now thread-safe. 2015-01-25 17:02:37 +00:00
Guillaume Gelin
3119fe087d Happy new year! 2015-01-06 15:26:33 +01:00
Araq
a9a5766c66 docgen should work again 2014-10-05 03:06:19 +02:00
Araq
42f5a838a3 more modules updated 2014-08-28 02:06:11 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00