Commit Graph

47 Commits

Author SHA1 Message Date
Clément Foucault
e856443c99 CLOG: Add getter to know if output supports coloring 2020-10-24 14:07:05 -04:00
Campbell Barton
a8fd3df905 Cleanup: spelling 2020-09-15 10:23:41 +10:00
Brecht Van Lommel
fd5d014b62 Fix build error after clog color printing changes 2020-09-10 19:40:54 +02:00
Ray Molenkamp
9bd10b1c92 CLog: Support colorized logging on windows
When using Windows Terminal the same control codes Linux
uses to colorize the text can be used. WT can be detected
by looking at the WT_SESSION environment variable.

Differential Revision: https://developer.blender.org/D8848

Reviewed by: campbellbarton
2020-09-10 11:31:09 -06:00
Ray Molenkamp
359acad5e4 Cleanup: CLog fix bad use_color default
`use_color` was defaulted to 'on' and only turned off when it was
decided the terminal didn't support this. This was the wrong
way to go about things, since that test only ran for Linux/Mac other
operating systems would get color formatting regardless if they
supported it.

The new default is `off` until the platform specific code inside
`CLG_ctx_output_set` turns it on after running some sanity checks.

This fix was part of the review of D8848 but deserved its on commit

Reviewed By: campbellbarton
2020-09-10 11:27:41 -06:00
Jacques Lucke
8a9912eaf8 Tests: fail automated tests on memory leaks and other internal errors
This adds a new `--debug-exit-on-error` flag. When it is set, Blender
will abort with a non-zero exit code when there are internal errors.
Currently, "internal errors" includes memory leaks detected by
guardedalloc and error/fatal log entries in clog.

The new flag is passed to Blender in various places where automated
tests are run. Furthermore, the `--debug-memory` flag is used in tests,
because that makes the verbose output more useful, when dealing
with memory leaks.

Reviewers: brecht, sergey

Differential Revision: https://developer.blender.org/D8665
2020-08-26 22:02:02 +02:00
Jacques Lucke
e414afbaf6 Cleanup: typos 2020-08-26 11:24:10 +02:00
Bastien Montagne
9cac158e96 Fix T78730: CLOG writes/reads outside allocated memory.
Fix several issues in CLOG code:
* In `clg_str_reserve`, allocated memory may be bigger than requested
  one, do not assign the latter back to `cstr->len_alloc`.
* `clg_str_vappendf` was mis-interpreting returned value from
  `vsnprintf`, and completely mixing total allocated memory and extra
  needed amount of memory to allocate...

Simplified code of `clg_str_vappendf` to only have allocating code
handled in one place, makes things easier to follow too.

Think this should also be beckported to 2.83.
2020-07-30 14:26:44 +02:00
Dalai Felinto
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
Campbell Barton
fae0685113 Cleanup: quiet warnings 2019-10-07 12:22:05 +11:00
Campbell Barton
167f5a61e5 C Logging: add macro to check if logging is enabled 2019-07-10 19:39:53 +10:00
Campbell Barton
177a0ca131 Cleanup: comments (long lines) in various intern/ libs 2019-05-01 21:00:56 +10:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton
47adab4f99 CMake: prepare for BLENDER_SORTED_LIBS removal
No functional change, this adds LIB definition and args to cmake files.
Without this it's difficult to migrate away from 'BLENDER_SORTED_LIBS'
since there are many platforms/configurations that could break when
changing linking order.

Manually add and enable WITHOUT_SORTED_LIBS to try building
without sorted libs (currently fails since all variables are empty).
This check will eventually be removed.

See T46725.
2019-04-14 15:37:24 +02:00
Campbell Barton
6eb59c5778 Cleanup: GCC redundant declarations
Previous waning suppression was only tested with clang.
2019-02-23 22:18:34 +11:00
Campbell Barton
702a2ba0ef Cleanup: quiet undeclared variable warnings 2019-02-23 19:20:20 +11:00
Campbell Barton
b6f8afc13a C logging: make pthread use optional
There is no need for threading for makesrna/makesdna,
disable it to avoid hassles linking build time utilities.
2019-02-22 19:45:22 +11:00
Campbell Barton
94f83a4ebd Fix T61765: thread-unsafe logging used 2019-02-21 11:33:50 +11:00
Campbell Barton
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
Campbell Barton
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
Campbell Barton
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton
68ae1f4958 Fix CLOG_STR_AT_SEVERITY macro
Part of D4277 by @sobakasu
2019-01-29 17:28:44 +11:00
Campbell Barton
c383d74228 Logging: add '--log-show-timestamp' option.
Part of D4214 by @sobakasu w/ edits.
2019-01-16 16:33:05 +11:00
Campbell Barton
302970b7a5 MSVC: remove compiler __func__ define
No longer needed and exposes a bug in clang-format see: D4185
2019-01-11 09:22:21 +11:00
Campbell Barton
5681631109 Cleanup: ensure header guards come first
Causes clang-format not to detect header guards,
indenting all preprocessor lines in the header.
2019-01-10 08:46:38 +11:00
Campbell Barton
f489db1c6b Haiku: build fix
D4130 by @miqlas
2019-01-04 17:04:07 +11:00
Campbell Barton
6fbd210b91 Merge branch 'master' into blender2.8 2018-08-08 11:05:08 +10:00
Campbell Barton
931a279f44 Cleanup: use static variables 2018-08-08 11:00:57 +10:00
Campbell Barton
c7e1d067a5 Merge branch 'master' into blender2.8 2018-07-31 21:27:51 +10:00
Campbell Barton
a3085190f8 Fix building w/ FreeBSD
fileno could be a macro which can't take a void pointer.
2018-07-31 20:52:36 +10:00
Campbell Barton
2451a1951e Merge branch 'master' into blender2.8 2018-05-18 11:02:39 +02:00
Campbell Barton
278e3f7d5f Logging: add --show-log-backtrace
Useful in debug builds to see a functions callers.
2018-05-18 11:00:47 +02:00
Nick Milios
94a62853ae Fix build error with Visual Studio / Windows.
Differential Revision: https://developer.blender.org/D3363
2018-05-13 15:51:42 +02:00
7a2e271e54 Fix compiler warnings. 2018-05-13 14:48:55 +02:00
Campbell Barton
c7cfee04c4 Logging: setting log level wasn't working 2018-05-04 08:00:22 +02:00
Campbell Barton
b4e8d33f11 Logging: edits to build on macOS 2018-04-16 07:38:11 +02:00
Antonio Vazquez
87a9b6ac06 Fix compiler error in Windows 2018-04-15 09:55:42 +02:00
Campbell Barton
66d4e9300b Logging: replace 'fwrite' w/ 'write'
We're already buffing output, so use write directly.
2018-04-14 13:59:33 +02:00
Campbell Barton
951d89b7b4 Cleanup: warning 2018-03-31 23:51:38 +02:00
Campbell Barton
ae3a1da1e6 Logging: fix own error with formatting 2018-03-31 15:43:47 +02:00
Campbell Barton
b237a1c2ea Use int instead of bool
Causes issues when including in some files.
2018-03-31 15:33:15 +02:00
Campbell Barton
db8e7f9780 Logging: add argument --log-show-basename
Optionally strips leading path from filenames when logging.
2018-03-31 15:29:46 +02:00
Campbell Barton
ac4513a5b8 Logging: add ability to exclude categories. 2018-03-31 12:52:47 +02:00
Campbell Barton
5f59c22bf1 Docs: doxygen docs for clog 2018-03-31 12:27:18 +02:00
Campbell Barton
b8a66973ac Fix clog: own error allocating from static buffer 2018-03-31 11:25:49 +02:00
Campbell Barton
af11eea3fd Fix logger build w/ MSVC 2018-03-31 09:18:30 +02:00
Campbell Barton
891c1cfc9a C Logging: use instead of printf for messages
- See `--log` help message for usage.
- Supports enabling categories.
- Color severity.
- Optionally logs to a file.
- Currently use to replace printf calls in wm module.

See D3120 for details.
2018-03-30 18:57:41 +02:00