Commit graph

27 commits

Author SHA1 Message Date
Atila Neves
e113440df1 Move logger out of experimental 2022-07-29 12:15:34 +02:00
Robert burner Schadek
1ebccd3717 move @trusted unittest to @system 2022-07-20 10:06:58 +02:00
Robert burner Schadek
63f49d6687 sharedLog returning shared(Logger)
Fixes #16232

changelog

-preview=nosharedaccess

code review

working on the tests

whitespace

spaces behind casts
2022-07-20 10:06:58 +02:00
Steven Schveighoffer
526beb3d84 Change default log level to info instead of warning. 2022-03-09 11:51:56 -05:00
Atila Neves
13eff04704 Address review comments 2022-01-03 15:14:33 +01:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Sebastian Wilzbach
233e90bdc1 Add PHOBOSSRC urls to std.experimental 2018-01-08 02:52:50 +01:00
Sebastian Wilzbach
61717ecc7d Sort imports 2017-06-12 07:54:38 +02:00
Sebastian Wilzbach
a36cec8686 DScanner: automatially set all unattributed unittests to @safe or @system 2017-02-22 05:42:04 +01:00
Sebastian Wilzbach
805c720595 Unify Phobos by ensuring there's always a space after cast(...)
Command:

sed -E 's/([^"])cast\(([^)]*?)\)([[:alnum:]])/\1cast(\2) \3/g' -i **/*.d
2017-02-21 16:40:20 +01:00
Jack Stouffer
67d44e4cdc Remove package wide std.algorithm imports from Phobos 2016-09-22 08:36:14 +01:00
crimaniak
c66c3208b9 Fix mistake in std.experimental.logger.multilogger unit test 2016-09-19 02:15:29 +03:00
Sönke Ludwig
f07dfe6df0 Add empty doc comments to all public Phobos modules to fix /library/.
The DDOX based documentation is configured to only show entities with doc comments and thus hides modules without one. This adds an empty comment to all public Phobos modules that have stayed undocumented so far.

They should probably get a proper documentation with description/license/copyright/.... This just fixes the documentation until then.
2016-06-06 10:53:11 +02:00
Joakim
10f2081c5e Modify remaining tests that create a temporary file in the local directory to use std.file.deleteme, which writes to /tmp or some other absolute path instead 2015-08-13 07:23:39 -05:00
Robert burner Schadek
eb9b3b16f1 logger cleanup2:
* random filenames were not the best idea
2015-06-12 11:30:46 +02:00
grogancolin
39f86b8cae Fixed some grammar errors in the help text 2015-05-21 14:26:38 +01:00
Robert burner Schadek
bc0f5254eb default LogLevel should all be equal
less

klickverbot

klickverbot
2015-03-29 20:05:34 +02:00
k-hara
1901f5badb Fix imports 2015-02-18 00:42:48 +09:00
k-hara
611a9a1b9b fix property enforcement 2015-02-10 01:00:36 +09:00
Robert burner Schadek
5ee9d8724d unittest to make sure everything is set right 2015-01-26 18:10:55 +01:00
Robert burner Schadek
d250e5cc26 Revert "Remove concurrency @trusted workarounds"
This reverts commit 299f0183e2661cb2640749a692a3463a0e51c1f9.

thread local forward

thread local default log function forward

nicer imports

forwardMsg must not be final

moved comments to package and started to integerade Martin's log disabling

more compile time function disabling

style and dscanner suggestions

stdThreadLog fix and doc

a lot of updates

* spell fixes
* better tests
* docu changes

docu update

whitespace

moduleLogLevel docu
2015-01-26 16:09:48 +01:00
Robert burner Schadek
bb1929b7b5 some more on multilogger
doc and style fixes mostly

rebase
2015-01-25 21:31:24 +01:00
Dicebot
e47421c878 Make std.concurrency constructors @safe
Fix safety of logger.core

Replaces @trusted abuse with @safe annotations and few occasional
@trusted tweaks.

Improve safety of all logger

Cleans usage of @safe and @trusted in derived modules
2015-01-25 21:31:24 +01:00
Robert burner Schadek
e0f29a68c0 MultiLogger rewrite
another doc update
2015-01-25 21:31:24 +01:00
Marco Leise
8b3631ed71 Made '__stdloggermutex' shared between threads, so it can fulfill its purpose.
Abstract methods have to be marked 'abstract', or the compiler wont complain about missing implementations, but instead assume they will be in some .o file that is later passed to the linker.

Made reads/writes to globalLogLevel atomic and separated global log level from stdlog's log level.

(Had to add a cast to the first array element of LogLevel arrays in foreach(). Possibly a compiler bug in 2.066 master.)

Avoid races with reading/writing the standard Logger:
 * User code can no longer directly read out the stdlog, because by the time it has the reference, it might already be obsolete. (Later an `opApply` style function could be provided to execute functions/delegates in the context of a locked stdlog.)
 * The stdlog property was split up into a public setter `stdlog` and a package getter `stdlogImpl`, because the compiler doesn't like different visibility for getter and setter.
 * All module level functions dealing with the stdlog now synchronize with the global `__stdloggermutex`.

static assert(__ctfe) doesn't do what one might expect. Code is always generated and emitted for `isLoggingActive` and it can be called at runtime. This commit turns the template function into just a template `isLoggingActiveAt` and a global bool flag `isLoggingActive`, so they can both be evaluated without parenthesis now and don't end up as functions in the final executable.

Fix: Unittesting symbols like randomString() are visible outside of the logger package.

Changed Logger methods to `final`, that are not documented as overridable to gain more control over the implementation details when I implement thread safety measures.
Made `fatalHandler` accessible as a property to allow synchronization in later commits.
Also made `writeLogMsg` protected, so it can assume it is properly synchronized already by the public calls calling it.
To log a pre-built message `forwardMsg` can now be used. (See `FileLogger`).

Fixed my mistake, where setting `stdlog` before querying `stdlogImpl` would revert the setting. And while I was at it, I changed `stdlog`s behavoir on assignment of `null`: It will now put the default logger back in place.

First attempt on making logging thread safe: Logger now has a mutex to protect its public API.
The module level functions don't perform any runtime checks themselves to avoid races.
Instead the logger does all checking under protection of its mutex.
`globalLogLevel` will be evaluated only once for any public logging call and thus needs no global locking.
All overrides of `writeLogMsg`, `beginLogMsg`, `logMsgPart` and `finishLogMsg` have `protected` visibility now, since they expect their logger to be already under mutex protection and must not be publically visible.

Fixed `MultiLogger` to not perform checks for its children to avoid races.

Small fix for `StdLoggerDisableLogging`.

some more unittests and some fixes

doc fixes

doc fix MrSmith33

Array problem

stupid me

stupid me

The getter for Logger.logLevel now uses an `atomicLoad` instead of full mutex lock.
Read-access to `stdlog` is now back...

Fixed inverted DDoc meaning for `isLoggingActive`.

Removed synchronization with a global lock for the duration of any standard logging call in an exchange of sequential consinstency for throughput.

Rejects valid: logf(LogLevel.fatal, "I am %s", true);
(The template constraint is not required in this case.)

Fix for `template isLoggingActive` that would break if an actual log level was disabled.
2015-01-25 21:31:23 +01:00
Robert burner Schadek
04aa499ce0 std.logger
some more docu fixes

fatel -> fatal

changed the way of calling

some rework

some better comments and win32.mak fix

more documentation

trying to figure out why win32 fails

test before you commit

another try to work around windows files and processes

maybe this time

maybe this merges

update 1 mostly soenke

MultiLogger and Logger have names

more docu

unittest fix

some better comments and win32.mak fix

Conflicts:
	std/logger.d

antoher doc fix

less code dup and more log functions

docs are now generated

some more fixing

speedup

some threading

forgot some

better docu gen and more testing

two new LogLevel, most functions are now at least @trusted

Tracer functionality

fatal delegate

some phobos style fixes

another bug bites the dust

version disable enhancements

default global LogLevel set to LogLevel.all

logLevel compare bugfix

delete of dead code

tab to whitespace

bugfixes, reduandency removal, and docu

multilogger was logging to all it childs without checking there LogLevel in
relation to the LogLevel of the LoggerPayload.

Some constructors where redundant.

more examples and more documentation

some fixes

NullLogger and moduleName

wrong doc

I splitted the multi logger implementations out

loglevelF to loglevelf in order to make phobos style think writefln

document building

win makefile fixes

some optimizations thanks to @elendel-
some whitespace

some updates from the github logger project

* stdio- and filelogger now use a templatelogger base to reduce code

makefile fixes

makefile

fixed the unittest

made sure the stdiologger is set up at the end

some comment fixes

finding the filelogger segfault

closed another file

a lookup fix

darwin unittest fail output

more diagnostics

* more documentation for the templatelogger and multilogger
* it breaks the log function api
 * log and logf now behave as their write and writef counterparts
 * for logging with an explicit LogLevel call logl loglf
 * for logging with an explicit condition call logc logcf
 * for logging with an explicit LogLevel and explicit condition call
 * loglc loglcf
 * the log function with an explicit LogLevel like info, warning, ...
 * can be extended into c, f or cf and therefore require a condition
 * and/or are printf functions

something is still interesting

rebase and lazy Args

saver file handling

whitespace

some updates

tracer is gone and more doc updates

codegen rework to allow log function comments

thread safe and concur works comments for free standing log functions

fixes #10

* free log function doco
* StdIOLogger prints now threadsafe
* concurrentcy hang fix

more docu

old file

even more doc

typo

* more better doc
* makefile fix

another fix

more unittests nearl 100% everywhere

another test

no more mixins more doc

win64 please pass

fixes from the review and voting

hope this fixes it

more comments

more docs more tests

more docu

more doc and fixes from jacob-carlborg

LogEntry.logger reference

more fixes

fileptr is gone

logger move to experimental/logger

type in win32/64 makefile

win makefile

nogc and threading

makefile fixes

some log calls take line and file as parameter
2015-01-25 21:30:47 +01:00