summaryrefslogtreecommitdiff
path: root/src/common/log.c
AgeCommit message (Collapse)Author
2016-12-16Merge branch 'prop271_030_v1_squashed'Nick Mathewson
2016-12-06Accept non-space whitespace characters in log severity syntax.J. Ryan Stinnett
Adds a test_config_parse_log_severity unit test to verify behavior. Fixes #19965.
2016-11-30Add a GUARD log domain, for use with new guards codeNick Mathewson
2016-10-27Automated change to use smartlist_add_strdupovercaffeinated
Use the following coccinelle script to change uses of smartlist_add(sl, tor_strdup(str)) to smartlist_add_strdup(sl, string) (coccinelle script from nickm via bug 20048): @@ expression a; expression b; @@ - smartlist_add + smartlist_add_strdup (a, - tor_strdup( b - ) )
2016-09-06checkSpace.pl now forbids more identifiers.Nick Mathewson
The functions it warns about are: assert, memcmp, strcat, strcpy, sprintf, malloc, free, realloc, strdup, strndup, calloc. Also, fix a few lingering instances of these in the code. Use other conventions to indicate _intended_ use of assert and malloc/realloc/etc.
2016-08-31setup_capture_of_logs: no longer suppress log messagesNick Mathewson
Previously setup_capture_of_logs would prevent log messages from going to the console entirely. That's a problem, since sometimes log messages are bugs! Now setup_capture_of_logs() acts sensibly. If you really do need to keep a message from going to the console entirely, there is setup_full_capture_of_logs(). But only use that if you're prepared to make sure that there are no extraneous messages generated at all.
2016-07-28Fix a huge pile of -Wshadow warnings.Nick Mathewson
These appeared on some of the Jenkins platforms. Apparently some GCCs care when you shadow globals, and some don't.
2016-06-15Mark src/common tor_assert(0)/tor_fragile_assert() unreached for coverageNick Mathewson
I audited this to make sure I was only marking ones that really should be unreachable.
2016-06-11Add -Wmissing-variable-declarations, with attendant fixesNick Mathewson
This is a big-ish patch, but it's very straightforward. Under this clang warning, we're not actually allowed to have a global variable without a previous extern declaration for it. The cases where we violated this rule fall into three roughly equal groups: * Stuff that should have been static. * Stuff that was global but where the extern was local to some other C file. * Stuff that was only global when built for the unit tests, that needed a conditional extern in the headers. The first two were IMO genuine problems; the last is a wart of how we build tests.
2016-02-27Update the copyright year.Nick Mathewson
2016-02-05Avoid calling log functions in logv when SMARTLIST_DEBUG is definedteor (Tim Wilson-Brown)
2016-02-05Check that the log mutex is initialised before trying to lock or unlock itteor (Tim Wilson-Brown)
2016-01-15Whitespace cleanupNick Mathewson
2016-01-13Revert my addition of callback cleaner and instead use existing ↵Ola Bini
functionality for temporary log files
2016-01-13Remove a small memory leak in log callback setupOla Bini
2015-12-15Replace usage of INLINE with inlinecypherpunks
This patch was generated using; sed -i -e "s/\bINLINE\b/inline/" src/*/*.[ch] src/*/*/*.[ch]
2015-10-02Fix check-spaces complaintsNick Mathewson
2015-09-30Document syslog_identity_tag for add_syslog_logPeter Palfrader
2015-09-30Add SyslogIdentityTagPeter Palfrader
When logging to syslog, allow a tag to be added to the syslog identity ("Tor"), i.e. the string prepended to every log message. The tag can be configured by setting SyslogIdentityTag and defaults to none. Setting it to "foo" will cause logs to be tagged as "Tor-foo". Closes: #17194.
2015-07-15Use C99 variadic macros when not on GCC.Nick Mathewson
1) We already require C99. 2) This allows us to support MSVC again (thanks to Gisle Vanem for this part) 3) This change allows us to dump some rotten old compatibility code from log.c
2015-03-24Merge remote-tracking branch 'public/bug15269'Nick Mathewson
2015-03-14Avoid double-parens in log_fn() messages on clang.Nick Mathewson
On clang (and elsewhere?) __PRETTY_FUNCTION__ includes parenthesized argument lists. This is clever, but it makes our old "%s(): " format look funny. This is a fix on 0957ffeb, aka svn:r288. Fixes bug 15269.
2015-03-14Log version when LD_BUG is logged.Nick Mathewson
Closes ticket 15026.
2015-02-06Avoid logging startup messages twiceSebastian Hahn
2015-02-05use ARRAY_LENGTH macro in domain_to_stringNick Mathewson
2015-02-05Add a string representation for LD_SCHED, and a extra sanity check.Yawning Angel
This both fixes the problem, and ensures that forgetting to update domain_list in the future will trigger the bug codepath instead of a NULL pointer deref.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-21Make log bufer 10k, not 9.78k.teor
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-10-23Fix minor typos, two line lengths, and a repeated includeteor
2014-09-10Remember log messages that happen before logs are configuredNick Mathewson
(And replay them once we know our first real logs.) This is an implementation for issue 6938. It solves the problem of early log mesages not getting sent to log files, but not the issue of early log messages not getting sent to controllers.
2014-09-10Refactor the 'deliver a log message' logic to its own function.Nick Mathewson
2014-09-10Turn log loop into a for loop, and "Does this lf want this" into a fnNick Mathewson
2014-09-10Refactor pending_cb_message_t into a type with proper functionsNick Mathewson
Also, rename it.
2014-07-16fix a c99-ismNick Mathewson
2014-07-16Add a tor_ftruncate to replace ftruncate.Nick Mathewson
(Windows doesn't have ftruncate, and some ftruncates do not move the file pointer to the start of the file.)
2014-07-16Add an option to overwrite logsArlo Breault
* Issue #5583
2014-05-20sandbox: support logfile rotationNick Mathewson
Fixes bug 12032; bugfix on 0.2.5.1-alpha
2014-04-15Uplift status.c unit test coverage with new test cases and macros.dana koch
A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
2014-02-15Remove a bunch of functions that were never called.Nick Mathewson
2013-11-22Handle unlikely negative time in tor_log_err_sigsafeNick Mathewson
Coverity wants this; CID 1130990.
2013-11-18Improve new assertion message loggingNick Mathewson
Don't report that a failure happened in the assertion_failed function just because we logged it from there.
2013-11-18Add a sighandler-safe logging mechanismNick Mathewson
We had accidentially grown two fake ones: one for backtrace.c, and one for sandbox.c. Let's do this properly instead. Now, when we configure logs, we keep track of fds that should get told about bad stuff happening from signal handlers. There's another entry point for these that avoids using non-signal-handler-safe functions.
2013-07-15Merge remote-tracking branch 'public/fancy_test_tricks'Nick Mathewson
Conflicts: src/common/include.am Conflict was from adding testsupport.h near where sandbox.h had already been added.
2013-07-11Add a basic seccomp2 syscall filter on LinuxCristian Toader
It's controlled by the new Sandbox argument. Right now, it's rather coarse-grained, it's Linux-only, and it may break some features.
2013-07-10Completely refactor how FILENAME_PRIVATE worksNick Mathewson
We previously used FILENAME_PRIVATE identifiers mostly for identifiers exposed only to the unit tests... but also for identifiers exposed to the benchmarker, and sometimes for identifiers exposed to a similar module, and occasionally for no really good reason at all. Now, we use FILENAME_PRIVATE identifiers for identifiers shared by Tor and the unit tests. They should be defined static when we aren't building the unit test, and globally visible otherwise. (The STATIC macro will keep us honest here.) For identifiers used only by the unit tests and never by Tor at all, on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS. This is not the motivating use case for the split test/non-test build system; it's just a test example to see how it works, and to take a chance to clean up the code a little.
2013-02-07Merge remote-tracking branch 'public/easy_ratelim'Nick Mathewson
Conflicts: src/or/connection.c
2013-02-07Merge remote-tracking branch 'public/bug7816_023'Nick Mathewson
Conflicts: src/common/util.c
2013-01-16Update the copyright date to 201.Nick Mathewson
2012-12-28Fix various small leaks on error casesNick Mathewson
Spotted by coverity, bug 7816, bugfix on various versions.