Commit graph

53 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
daleglass
6c25b9470d
Update libraries/shared/src/LogHandler.cpp
Co-authored-by: kasenvr <52365539+kasenvr@users.noreply.github.com>
2020-10-29 19:20:18 +01:00
Dale Glass
1124590422 Enable color by default on Unix, change to comma separators.
Also emit a message if an unrecognized log option is used.
2020-10-16 20:16:44 +02: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
Andrew Meadows
16ef30ced0 don't flushRepeatedMessages() in LogHandler dtor 2019-02-05 17:14:25 -08:00
Clement
333cbc99ad Remove static logging 2018-07-30 17:18:32 -07:00
Simon Walton
f10bbce557 Squelch initialization warning 2018-04-04 18:32:40 -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
ce5f6da6ca Restore setup of flush timer that was inadvertently lost 2018-04-04 14:43:26 -07:00
Simon Walton
ed3347a89b Repeated logging - reviewer fixes 2018-04-04 14:11:10 -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
5b0bcd76e3 Repeated logging - Fixes and clean-up 2018-04-03 12:23:21 -07:00
Simon Walton
a7fc6a2991 Repeated logs - use #define to replace qCDebug 2018-04-03 10:44:53 -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
Atlante45
2a204533f4 Add comments to startup processes 2018-02-26 16:25:41 -08:00
Atlante45
277e556b48 Create a standard function to init Hifi Apps 2018-02-22 17:06:09 -08:00
humbletim
fd917917c4 include the source basename in Script.print() && QML/Script console.*() debug output 2017-09-29 14:48:01 -04:00
Atlante45
2962dd6dc2 Factor LogDialog 2017-02-09 13:04:43 -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
Ryan Huffman
2bb2aca2be Remove commented line in LogHandler 2016-10-04 16:54:37 -07:00
Ryan Huffman
a52e2d8bc5 Add category to log lines 2016-10-04 16:49:24 -07:00
Atlante45
6d2498b4f2 Remove debug print 2016-03-21 14:50:18 -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
Atlante45
c8c9118d4d Improve script engine error logging + some cleanup 2015-10-27 12:11:27 -07:00
Atlante45
598aab884e Make log more readable 2015-10-05 14:59:28 -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
5c3e90f64f resolve conflicts on merge with upstream master 2014-12-03 13:11:56 -08:00
Stephen Birarda
8c65c6c1c8 fix comment for actual time format 2014-11-18 17:02:28 -08:00
Stephen Birarda
705d3da089 cleanup time in log prefix 2014-11-18 17:00:33 -08:00
Stephen Birarda
86284036f1 put back timestamp in log 2014-11-14 10:35:13 -08:00
Stephen Birarda
e10d132f75 avoid Qt QTimer thread bug by putting SoundCache on same thread 2014-11-13 14:47:28 -08:00
Stephen Birarda
3f44203984 remove getpid usage and replace with Qt solution 2014-11-05 11:42:40 -08:00
Stephen Birarda
6b922fc3e7 final tweak for linux unistd include 2014-10-30 10:03:36 -07:00
Stephen Birarda
7f3482bbdd swithc from elif to elsif 2014-10-29 10:53:34 -07:00
Stephen Birarda
03e1da0ba9 include unistd only on Q_OS_LINUX 2014-10-29 10:37:39 -07:00
Andrew Meadows
c39b239f99 fix linux build for missing getpid() 2014-10-29 09:30:51 -07:00
Stephen Birarda
9af097967d remove ctime since windows build did not fail without it 2014-10-28 15:56:30 -07:00
Stephen Birarda
992396ba63 add ctime for strftime call 2014-10-28 15:48:06 -07:00
Stephen Birarda
01de6305e9 add time header for date in log entry 2014-10-28 15:42:03 -07:00
Stephen Birarda
c4538836c1 always output the first matching repeated log message 2014-10-28 14:51:47 -07:00