Commit graph

24 commits

Author SHA1 Message Date
Dale Glass
aab5b22e25 Skip duplicated log entries
This helps with log flooding. Successive repeated log messages will be skipped and counted,
the count will be output when a different message is logged.

A new option of 'keep_repeats' has been added to VIRCADIA_LOG_OPTIONS to disable this.
2021-01-09 19:39:32 +01:00
Dale Glass
895d4d4172 Improve logging: color, ms timestamps, PID, thread id via environment variable
Set VIRCADIA_LOG_OPTIONS to a string containing these keywords:

	color
	milliseconds
	process_id
	thread_id

The separator doesn't matter. Example:

    $ export VIRCADIA_LOG_OPTIONS="color milliseconds"
2020-10-13 20:22:01 +02:00
Clement
527b27b32d Make sure the flush timer is not spawned too early 2019-09-18 17:05:05 -07:00
Simon Walton
d05f0600d4 Handle one-time messages outside LogHandler class
Also change to std::call_once for the file-scope message IDs.
2018-04-04 15:44:47 -07:00
Simon Walton
ed3347a89b Repeated logging - reviewer fixes 2018-04-04 14:11:10 -07:00
Simon Walton
692ccfc09b Create HIFI_FCDEBUG(_ID) variants that require a category
Original macros use default settings.
2018-04-04 09:49:15 -07:00
Simon Walton
7d16ca9c1c Remove uses of addRepeatedMessageRegex() and its implementation
Change to new log-message ID scheme.
2018-04-03 17:54:01 -07:00
Simon Walton
d4ab06b1d4 Move HIFI_FDEBUG macro to LogHandler.h
Not all uses of repeated log messages include NetworkLogging.h,
but if they use addRepeatedMessageRegex() they must include
LogHandler.h. Also add second macro for client-supplied
message ID.
2018-04-03 15:53:12 -07:00
Simon Walton
6d078f41e7 Use unique IDs for log strings that should have repeats supressed 2018-04-02 17:32:18 -07:00
Simon Walton
cc166dbece LogHandler regexps - use vector of values 2018-03-09 15:44:56 -08:00
Simon Walton
d4cf22fbaf LogHandler class stores regexps - code tweaks
Code standard changes from review.
2018-03-09 15:29:10 -08:00
Simon Walton
4b27cd73ff LogHandler class stores regexps rather than always recreating
General efficiency tweaks; move to C++11.
2018-03-09 15:29:09 -08:00
Stephen Birarda
5c5c69fff3 setup the repeated message flusher on LogHandler thread 2017-01-20 11:20:48 -08:00
Atlante45
ae29fe8ab2 Logging improvements 2016-11-04 14:26:19 -07:00
Seth Alves
af5be8d1d9 reduce data-races in logging 2016-10-18 15:59:00 -07:00
Anthony J. Thibault
b5b3a40233 LogHandler: add option to display milliseconds in timestamp 2016-02-25 10:03:12 -08:00
Stephen Birarda
4cbbd24c7e complete handling of immediate temp name grab 2016-01-19 13:04:05 -08:00
Anthony J. Thibault
2eb62f2fd8 LogHandler: fix for linux build 2015-10-30 17:44:06 -07:00
Anthony J. Thibault
f50e1a0977 Fix for rare crash in LogHandler::flushRepeatedMessages()
This can happen when LogHandler::flushRepetedMessages is called on
the main thread, while the application is printing messages on
a separate thread.  The access to the _lastRepeatedMessage QHash was
not guarded.

I've added two mutexes to guard access to both the repeatedMessage
hashes/regexes and the onlyOnceMessages/regexes.  This will unfortunately
incur a performance hit for frequent debug logging, but that's better
then crashing.

Also, I've added the ability to print threadIDs as well as Process ids.
This is helpful when debugging multi-threaded access to shared variables.
2015-10-30 17:18:37 -07:00
Brad Davis
d311e4f2ea Fixing problems reported by static analysis tool 2015-08-25 19:18:55 -07:00
Seth Alves
bb7b132b78 Add a way to indicate that a specific message of a certain form should only be printed once. Different messages that match the same form will each be printed once. 2015-03-02 14:18:26 -08:00
Stephen Birarda
424793b905 complete output of suppressed repeated messages to log 2014-10-28 14:49:14 -07:00
Stephen Birarda
8e3102266a use the LogHandler in Interface 2014-10-28 14:23:34 -07:00
Stephen Birarda
d3bbd251db move Logging to LogHandler 2014-10-28 13:59:23 -07:00
Renamed from libraries/networking/src/Logging.h (Browse further)