]> git.ipfire.org Git - thirdparty/knot-resolver.git/log
thirdparty/knot-resolver.git
3 years agoMerge branch 'dns64-features' into 'master' obs-knot-resolver-es11k1/deployments/1835 obs-knot-resolver-es11k1/deployments/1837 obs-knot-resolver-es11k1/deployments/1838 obs-knot-resolver-es11k1/deployments/1839 obs-knot-resolver-es11k1/deployments/1840 495/merge 506/merge 581/merge 818/merge
Tomas Krizek [Wed, 25 Aug 2021 11:32:53 +0000 (11:32 +0000)] 
Merge branch 'dns64-features' into 'master'

modules/dns64: new features

Closes #478 and #368

See merge request knot/knot-resolver!1201

3 years agomodules/dns64: improve code readability
Tomas Krizek [Mon, 23 Aug 2021 16:03:36 +0000 (18:03 +0200)] 
modules/dns64: improve code readability

3 years agomodules/dns64: document the new features
Vladimír Čunát [Tue, 10 Aug 2021 18:28:28 +0000 (20:28 +0200)] 
modules/dns64: document the new features

3 years agomodules/dns64: implement "exclusion prefixes"
Vladimír Čunát [Tue, 10 Aug 2021 17:42:28 +0000 (19:42 +0200)] 
modules/dns64: implement "exclusion prefixes"

The RFC says we MUST do it, though this implementation is lazy and
avoids a SHOULD in the RFC.

3 years agolib/utils kr_straddr_subnet() nit
Vladimír Čunát [Tue, 10 Aug 2021 17:34:40 +0000 (19:34 +0200)] 
lib/utils kr_straddr_subnet() nit

For example, absolute path meant for AF_UNIX could confuse this.

3 years agomodules/dns64: add kr_query::flags.DNS64_DISABLE
Vladimír Čunát [Tue, 10 Aug 2021 08:42:54 +0000 (10:42 +0200)] 
modules/dns64: add kr_query::flags.DNS64_DISABLE

It's not a perfect solution and with the future policy engine it will
hopefully be better, but it's really trivial to add this already.
(should've done that years ago)

3 years agomodules/dns64: also map the reverse (PTR) subtree
Vladimír Čunát [Mon, 9 Aug 2021 18:28:58 +0000 (20:28 +0200)] 
modules/dns64: also map the reverse (PTR) subtree

3 years agomodules/dns64: allow configuring by a table
Vladimír Čunát [Tue, 10 Aug 2021 09:21:13 +0000 (11:21 +0200)] 
modules/dns64: allow configuring by a table

Backward compatible.  It will be useful when adding further features.
Also improve config error traces.

3 years agoMerge branch 'release-5-4-1' into 'master' obs-knot-resolver-8xyvhu/deployments/1828 obs-knot-resolver-es11k1/deployments/1829 obs-knot-resolver-es11k1/deployments/1830 obs-knot-resolver-es11k1/deployments/1831 obs-knot-resolver-es11k1/deployments/1832 obs-knot-resolver-es11k1/deployments/1833 obs-knot-resolver-es11k1/deployments/1834 obs-knot-resolver-kv62s6/deployments/1827 v5.4.1
Tomas Krizek [Thu, 19 Aug 2021 12:31:38 +0000 (12:31 +0000)] 
Merge branch 'release-5-4-1' into 'master'

release 5.4.1

See merge request knot/knot-resolver!1204

3 years agorelease 5.4.1
Tomas Krizek [Thu, 19 Aug 2021 11:33:27 +0000 (13:33 +0200)] 
release 5.4.1

3 years agoMerge branch 'doh2-free-unsent-streams' into 'master'
Tomas Krizek [Thu, 19 Aug 2021 12:26:41 +0000 (12:26 +0000)] 
Merge branch 'doh2-free-unsent-streams' into 'master'

doh2: ensure memory from unsent streams is freed

See merge request knot/knot-resolver!1202

3 years agodoh2: use stream_write_data instead of stream user_data obs-knot-resolver-bs4hbr/deployments/1824
Tomas Krizek [Wed, 18 Aug 2021 14:22:17 +0000 (16:22 +0200)] 
doh2: use stream_write_data instead of stream  user_data

3 years agodoh2: handle OOM when allocating callbacks
Tomas Krizek [Wed, 18 Aug 2021 14:09:33 +0000 (16:09 +0200)] 
doh2: handle OOM when allocating callbacks

3 years agodoh2: ensure memory from unsent streams is freed
Tomas Krizek [Wed, 18 Aug 2021 13:18:27 +0000 (15:18 +0200)] 
doh2: ensure memory from unsent streams is freed

The nghttp2 on_stream_close callback is only called for streams that are
properly closed. If we need to tear down the HTTP connection due to any
reason (e.g. IO error in underlying layer), some streams may not be
propely closed.

Due to HTTP/2 flow control, we may also wait indefinitely for the data
to be written. This can also cause the stream to never be properly
closed.

To handle these cases, a reference of allocated data is kept and we
ensure everything is freed once we're closing the http session.

3 years agoMerge !1203: docker: update to Debian 11 obs-knot-resolver-es11k1/deployments/1823
Vladimír Čunát [Wed, 18 Aug 2021 15:23:18 +0000 (15:23 +0000)] 
Merge !1203: docker: update to Debian 11

3 years agodocker: update to Debian 11
Tomas Krizek [Wed, 18 Aug 2021 15:10:12 +0000 (17:10 +0200)] 
docker: update to Debian 11

3 years agoMerge branch 'log-policy' into 'master' obs-knot-resolver-es11k1/deployments/1817 obs-knot-resolver-es11k1/deployments/1818 obs-knot-resolver-es11k1/deployments/1819 obs-knot-resolver-es11k1/deployments/1820 obs-knot-resolver-es11k1/deployments/1821 obs-knot-resolver-es11k1/deployments/1822 1144/merge
Tomas Krizek [Tue, 10 Aug 2021 20:06:39 +0000 (20:06 +0000)] 
Merge branch 'log-policy' into 'master'

policy trace-logging improvements, mainly

See merge request knot/knot-resolver!1199

3 years agomodules/bogus_log nits
Vladimír Čunát [Mon, 9 Aug 2021 08:00:12 +0000 (10:00 +0200)] 
modules/bogus_log nits

- use notice log level instead of error
  The failure is often a normal condition but we probably want it
  logged by default (after explicitly loading the module).
- don't repeat the "dnssec" word twice in a row (+update docs)
- docs bogus_log.frequent(): we format tables differently (old change)

3 years agopolicy docs: rewrite the section about logging actions
Vladimír Čunát [Fri, 6 Aug 2021 19:19:13 +0000 (21:19 +0200)] 
policy docs: rewrite the section about logging actions

Partly to document changes from recent changes,
partly to fix long-lasting issues in the descriptions.
Hopefully it will be easier to understand now.

3 years agopolicy trace-logging improvements
Vladimír Čunát [Fri, 6 Aug 2021 17:17:18 +0000 (19:17 +0200)] 
policy trace-logging improvements

The logs can be triggered from policy actions, in per-request fashion:
- they're on LOG_DEBUG level but always sent, regardless of log config
- those messages will show double group tags: "[reqdbg][foo   ]"
  (but they lack proper meta-data - about location of the log's origin)
- reqdbg is *in addition* to normal logs, so the lines may be duplicated
  if that's how the logging was configured

3 years agolib/log: add [rdebug] group
Vladimír Čunát [Fri, 6 Aug 2021 17:10:34 +0000 (19:10 +0200)] 
lib/log: add [rdebug] group

It's special: always on and not shown in log_groups() output.

It's been quite a long fight to find how to best deal with such
a special case (from user perspective; code itself is easy).

3 years agotrace_log: include the "[group]" tag in the messages
Vladimír Čunát [Wed, 4 Aug 2021 09:40:30 +0000 (11:40 +0200)] 
trace_log: include the "[group]" tag in the messages

3 years agolua kr_request_t::selected:tostring(): adjust style
Vladimír Čunát [Wed, 4 Aug 2021 18:59:59 +0000 (20:59 +0200)] 
lua kr_request_t::selected:tostring(): adjust style

The result gets logged as a single multi-line message,
so let's not repeat any prefix on (some of) those in-the-middle lines.

3 years agolib/log kr_log_fmt(): pass parameters more properly
Vladimír Čunát [Wed, 4 Aug 2021 19:11:51 +0000 (21:11 +0200)] 
lib/log kr_log_fmt(): pass parameters more properly

Systemd docs say:
> Those arguments must contain valid journal entries including
> the variable name, e.g. "CODE_FILE=src/foo.c", [...]

I tried that passing all three strings empty (without variable name)
wouldn't result into the line getting logged; the suggested style does.

3 years agolib/log nit: fix order of the levels
Vladimír Čunát [Thu, 5 Aug 2021 08:46:50 +0000 (10:46 +0200)] 
lib/log nit: fix order of the levels

I suspect it was me who broke the ordering here.

3 years agoadjust RR-dumping style a little
Vladimír Čunát [Fri, 6 Aug 2021 09:52:26 +0000 (11:52 +0200)] 
adjust RR-dumping style a little

The former "default" dumping style isn't really used anywhere in Knot.
The only visible difference is that RRSIGs are now logged *without*
replacing their TTLs by the original non-decremented TTL values.
That can avoid some confusion when reading debug logs.
(Those original TTLs are still shown a bit further on each line.)

3 years agodaemon: fix --version output
Vladimír Čunát [Thu, 5 Aug 2021 08:44:38 +0000 (10:44 +0200)] 
daemon: fix --version output

Logging is not set up at this point; it wouldn't be shown unless
preceded by -v/--verbose.

3 years agoMerge branch 'nits' into 'master'
Tomas Krizek [Mon, 9 Aug 2021 12:36:04 +0000 (12:36 +0000)] 
Merge branch 'nits' into 'master'

various tiny changes

See merge request knot/knot-resolver!1200

3 years agoci build:macOS: skip in security repo
Vladimír Čunát [Fri, 11 Dec 2020 08:00:36 +0000 (09:00 +0100)] 
ci build:macOS: skip in security repo

Code wouldn't be leaked.  We'd just send the branch name to GH servers.
Still, it' better to skip the step.

3 years agolua kres.type: add new constants
Vladimír Čunát [Mon, 9 Aug 2021 06:41:55 +0000 (08:41 +0200)] 
lua kres.type: add new constants

This is all that's missing in comparison to enum knot_rr_type.
For now I didn't remove types that aren't present there (anymore),
even though noone would miss them, most likely.

3 years agodoc/build: add a couple optional dependencies
Vladimír Čunát [Fri, 9 Jul 2021 09:50:51 +0000 (11:50 +0200)] 
doc/build: add a couple optional dependencies

Also improve a few details.

3 years agodnstap: avoid a false-positive warning
Vladimír Čunát [Mon, 3 May 2021 17:53:35 +0000 (19:53 +0200)] 
dnstap: avoid a false-positive warning

../modules/dnstap/dnstap.c: In function 'dnstap_config':
../modules/dnstap/dnstap.c:410:29: warning: 'strndup' specified bound 4096 exceeds source size 17 [-Wstringop-overread]
  410 |                 sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
      |                             ^
../modules/dnstap/dnstap.c:423:37: warning: 'strndup' specified bound 4096 exceeds source size 17 [-Wstringop-overread]
  423 |                         sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
      |                                     ^

We don't need to restrict our built-in path defaults to PATH_MAX
characters, as they just can't be that long and it's not an issue if we
shoot over it anyway - opening such a file would only fail.

3 years agoMerge branch 'kres_gen_test-cross' into 'master' obs-knot-resolver-es11k1/deployments/1815 obs-knot-resolver-es11k1/deployments/1816
Tomas Krizek [Thu, 5 Aug 2021 11:53:19 +0000 (11:53 +0000)] 
Merge branch 'kres_gen_test-cross' into 'master'

daemon/lua/meson.build: disable kres_gen_test on cross

See merge request knot/knot-resolver!1198

3 years agodaemon/lua/meson.build: disable kres_gen_test on cross
Vladimír Čunát [Thu, 5 Aug 2021 08:10:16 +0000 (10:10 +0200)] 
daemon/lua/meson.build: disable kres_gen_test on cross

I considered switching it to our usual 3-option combo,
but that way didn't really seem useful.

3 years agodaemon/lua/meson.build: whitespace
Vladimír Čunát [Thu, 5 Aug 2021 08:09:05 +0000 (10:09 +0200)] 
daemon/lua/meson.build: whitespace

I didn't intend to use this mix of tabs and spaces for indentation.

4 years agoMerge branch 'no-doh' into 'master' obs-knot-resolver-es11k1/deployments/1809 obs-knot-resolver-es11k1/deployments/1810 obs-knot-resolver-es11k1/deployments/1811 obs-knot-resolver-es11k1/deployments/1812 obs-knot-resolver-es11k1/deployments/1813 obs-knot-resolver-es11k1/deployments/1814
Tomas Krizek [Fri, 30 Jul 2021 11:52:14 +0000 (11:52 +0000)] 
Merge branch 'no-doh' into 'master'

fix build without doh2 support

See merge request knot/knot-resolver!1197

4 years agofix build without doh2 support
Vladimír Čunát [Fri, 30 Jul 2021 07:49:04 +0000 (09:49 +0200)] 
fix build without doh2 support

4 years agoMerge branch 'release-5-4-0' into 'master' obs-knot-resolver-8xyvhu/deployments/1807 obs-knot-resolver-es11k1/deployments/1808 obs-knot-resolver-kv62s6/deployments/1806 v5.4.0
Tomas Krizek [Thu, 29 Jul 2021 14:25:42 +0000 (14:25 +0000)] 
Merge branch 'release-5-4-0' into 'master'

release 5.4.0

See merge request knot/knot-resolver!1196

4 years agorelease 5.4.0
Tomas Krizek [Wed, 28 Jul 2021 14:31:03 +0000 (16:31 +0200)] 
release 5.4.0

4 years agodistro/tests: switch to a more reliable domain with broken DNSSEC
Tomas Krizek [Thu, 29 Jul 2021 13:09:19 +0000 (15:09 +0200)] 
distro/tests: switch to a more reliable domain with broken DNSSEC

4 years agoMerge branch 'doh-free-headers' into 'master'
Tomas Krizek [Thu, 29 Jul 2021 12:25:31 +0000 (12:25 +0000)] 
Merge branch 'doh-free-headers' into 'master'

daemon/http: ensure HTTP headers are freed

See merge request knot/knot-resolver!1191

4 years agodaemon/http: fix crash on large buffers and document logic issues
Tomas Krizek [Fri, 23 Jul 2021 15:21:07 +0000 (17:21 +0200)] 
daemon/http: fix crash on large buffers and document logic issues

4 years agodaemon/http: add more info to debug messagess
Tomas Krizek [Wed, 21 Jul 2021 11:36:17 +0000 (13:36 +0200)] 
daemon/http: add more info to debug messagess

4 years agodaemon/http: add helper assert to detect potential memleak
Tomas Krizek [Fri, 2 Jul 2021 09:46:45 +0000 (11:46 +0200)] 
daemon/http: add helper assert to detect potential memleak

4 years agodaemon/worker: ensure HTTP headers are freed on ignored queries
Tomas Krizek [Fri, 2 Jul 2021 08:48:32 +0000 (10:48 +0200)] 
daemon/worker: ensure HTTP headers are freed on ignored queries

Ignored queries never call create_request() where ownership of headers
is taken care of. They need to be explicitly cleared instead, because
we're the owners of the pointer here.

4 years agodaemon/http: refactor submitting to wirebuffer
Tomas Krizek [Wed, 30 Jun 2021 20:47:38 +0000 (22:47 +0200)] 
daemon/http: refactor submitting to wirebuffer

4 years agodaemon/http: ensure missing variable in URI is treated as error
Tomas Krizek [Wed, 30 Jun 2021 20:43:11 +0000 (22:43 +0200)] 
daemon/http: ensure missing variable in URI is treated as error

4 years agodaemon/http: ensure headers are freed
Tomas Krizek [Wed, 30 Jun 2021 14:20:21 +0000 (16:20 +0200)] 
daemon/http: ensure headers are freed

4 years agodaemon/http: refactor freeing headers into function
Tomas Krizek [Wed, 30 Jun 2021 14:18:54 +0000 (16:18 +0200)] 
daemon/http: refactor freeing headers into function

4 years agoMerge branch 'fine-grained-logging' into 'master'
Tomas Krizek [Thu, 29 Jul 2021 12:01:05 +0000 (12:01 +0000)] 
Merge branch 'fine-grained-logging' into 'master'

Fine grained logging

See merge request knot/knot-resolver!1181

4 years agologging: update kres-gen-31.lua
Tomas Krizek [Thu, 29 Jul 2021 11:44:58 +0000 (13:44 +0200)] 
logging: update kres-gen-31.lua

4 years agolua logging: expand the printf in lua already
Vladimír Čunát [Thu, 29 Jul 2021 10:55:42 +0000 (12:55 +0200)] 
lua logging: expand the printf in lua already

- we've been using lua's formatting so far, so avoid changing that
- some lua values would be harder to format with the C style

4 years agolib/utils logging nit: use another logging group
Vladimír Čunát [Wed, 28 Jul 2021 19:49:59 +0000 (21:49 +0200)] 
lib/utils logging nit: use another logging group

Our randomness utils have nothing to do with TLS, so let's use SYSTEM.

4 years agolib/log.h: improve readability (hopefully)
Vladimír Čunát [Wed, 28 Jul 2021 19:00:07 +0000 (21:00 +0200)] 
lib/log.h: improve readability (hopefully)

* improve order
  - follow grouping of topics more closely (targets, groups, levels)
  - order kr_log_LEVEL by severity
* move unneeded <stdarg.h>
* improve doc-comments
  - some claims there were even wrong now
  - describe some log levels at kr_log_LEVEL

4 years agolib/log kr_log_name2grp(): return -1 on failures
Vladimír Čunát [Wed, 28 Jul 2021 17:39:22 +0000 (19:39 +0200)] 
lib/log kr_log_name2grp(): return -1 on failures

Let's be consistent witk kr_log_name2level()
and even generally we tend to use negative numbers for errors.

4 years agolib/log level names: disregard SYSLOG_NAMES
Vladimír Čunát [Wed, 28 Jul 2021 17:29:51 +0000 (19:29 +0200)] 
lib/log level names: disregard SYSLOG_NAMES

It's a non-standard feature of syslog.h and I don't think it's worth
the trouble.

We didn't really utilize it; someone would have to #define it,
and moreover we would get into problems if this wasn't being done
the same on all places including log.h.
Making the names adapt to the platform would also mean that
config files and docs wouldn't be portable.

Also make kr_log_level2name() return const.

4 years agolib/log.h nit: tweak macro for __LINE__
Vladimír Čunát [Wed, 28 Jul 2021 16:26:59 +0000 (18:26 +0200)] 
lib/log.h nit: tweak macro for __LINE__

- we don't need doubling the layer in this case,
  as the SD_JOURNAL_METADATA macro adds a layer already
- `TO_STR` was perhaps a too short name and could collide

4 years agodoc: add changes revelant for custom modules
Tomas Krizek [Wed, 28 Jul 2021 11:48:53 +0000 (13:48 +0200)] 
doc: add changes revelant for custom modules

4 years agologging: linter nitpicks
Tomas Krizek [Tue, 27 Jul 2021 21:56:59 +0000 (23:56 +0200)] 
logging: linter nitpicks

4 years agologging: add lua API test coverage
Tomas Krizek [Tue, 27 Jul 2021 21:34:26 +0000 (23:34 +0200)] 
logging: add lua API test coverage

4 years agologging: use log_groups() lua API
Tomas Krizek [Tue, 27 Jul 2021 21:12:03 +0000 (23:12 +0200)] 
logging: use log_groups() lua API

Use a single call as a setter and getter for log groups.

4 years agologging: use log_target() lua API
Tomas Krizek [Tue, 27 Jul 2021 20:12:12 +0000 (22:12 +0200)] 
logging: use log_target() lua API

Refactor into more consistent lua API.

4 years agolog: use log_level() lua API
Tomas Krizek [Tue, 27 Jul 2021 20:08:01 +0000 (22:08 +0200)] 
log: use log_level() lua API

Using a single function to get/set values is more consistent with our
existing lua API rather than having two separate set and get functions.

4 years agotreewide: avoid using the deprecated verbose()
Vladimír Čunát [Tue, 27 Jul 2021 08:29:22 +0000 (10:29 +0200)] 
treewide: avoid using the deprecated verbose()

It's mainly in tests.

4 years agolib/log: redesign startup and target selection
Vladimír Čunát [Mon, 26 Jul 2021 18:58:50 +0000 (20:58 +0200)] 
lib/log: redesign startup and target selection

- add lua set_log_target() + docs
- default to 'stderr' (manual runs)
- switch to 'syslog' in distro-preconfig.lua
- a few minor tweaks

4 years agolib/log detail: avoid a bit of duplication
Vladimír Čunát [Mon, 26 Jul 2021 18:56:43 +0000 (20:56 +0200)] 
lib/log detail: avoid a bit of duplication

4 years agolib/log.h: avoid defining types without kr_ prefix
Vladimír Čunát [Mon, 26 Jul 2021 17:21:50 +0000 (19:21 +0200)] 
lib/log.h: avoid defining types without kr_ prefix

Probably, it seems "more consistent".
Some defines still don't have it, but I left those.

4 years agolog: use kr_log_crit instead of kr_log_fatal
Lukáš Ježek [Mon, 26 Jul 2021 12:55:58 +0000 (14:55 +0200)] 
log: use kr_log_crit instead of kr_log_fatal

4 years agolib/log: slightly improve log group description and their ordering
Tomas Krizek [Fri, 23 Jul 2021 11:53:17 +0000 (13:53 +0200)] 
lib/log: slightly improve log group description and their ordering

4 years agodoc: logging
Lukáš Ježek [Thu, 22 Jul 2021 09:48:35 +0000 (11:48 +0200)] 
doc: logging

4 years agodoc: log() functions
Lukáš Ježek [Wed, 21 Jul 2021 11:31:24 +0000 (13:31 +0200)] 
doc: log() functions

4 years agoetc/config: Remove log functions
Lukáš Ježek [Wed, 21 Jul 2021 10:50:04 +0000 (12:50 +0200)] 
etc/config: Remove log functions

4 years agolog: add log functions and LOG_GRP_MODULE group for users's modules
Lukáš Ježek [Wed, 21 Jul 2021 09:40:29 +0000 (11:40 +0200)] 
log: add log functions and LOG_GRP_MODULE group for users's modules
logging

4 years agolib/utils: drop a pair of unused macros
Vladimír Čunát [Tue, 13 Jul 2021 11:18:18 +0000 (13:18 +0200)] 
lib/utils: drop a pair of unused macros

4 years agotreewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.
Vladimír Čunát [Tue, 13 Jul 2021 11:05:40 +0000 (13:05 +0200)] 
treewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.

The main problem there was ignoring the log groups,
and VERBOSE_STATUS also ignores trace-logging.
Typically the new kr_log_is_debug*() are the best choice.

In a couple places with heavy WITH_VERBOSE usage it's
instead locally redefined to consider the right group.

4 years agovalidate: add kr_rrset_validation_ctx_t::log_qry
Vladimír Čunát [Tue, 13 Jul 2021 10:06:28 +0000 (12:06 +0200)] 
validate: add kr_rrset_validation_ctx_t::log_qry

... so we can use it for more precise logging.  Some calls get simpler.
In particular, without the associated request, we can't produce anything
into trace-logs, which could be confusing.  Normal logs will benefit, too.
(more precise replacement of WITH_VERBOSE will come in a subsequent commit)

4 years agolib/log: add kr_log_is_debug*()
Vladimír Čunát [Mon, 12 Jul 2021 20:19:20 +0000 (22:19 +0200)] 
lib/log: add kr_log_is_debug*()

... and optimize a suspect hot path (through VERBOSE_MSG)

4 years agolib/log: make trace-logging not prevent normal logging
Vladimír Čunát [Mon, 12 Jul 2021 19:37:52 +0000 (21:37 +0200)] 
lib/log: make trace-logging not prevent normal logging

I think it's an old issue, but why not fix it now.
I believe it's better when these two are "independent".

Removed comment: once upon a time it belonged to auto_free
and similar macros, but somehow it survived various moves.

4 years agorework logging from control sockets (+simplify)
Vladimír Čunát [Mon, 12 Jul 2021 18:02:12 +0000 (20:02 +0200)] 
rework logging from control sockets (+simplify)

- unify interactive mode to stdout
- use its own logging group
- elevated log level when the command throws an exception
- don't try detecting that the logs go back into the same console
  (yes, in that case you can see some lines twice)
- don't make the binary mode turn off logging

4 years agoQRVERBOSE: fix ignoring the log groups
Vladimír Čunát [Mon, 12 Jul 2021 20:00:15 +0000 (22:00 +0200)] 
QRVERBOSE: fix ignoring the log groups

It would be yet another condition to check; overall I think the
necessary checks would get too complex to be done in a macro
and therefore copied all over the place.

Note: it's interesting that such a change reduces binary size
by about 3% (on master), and I suspect that speed won't suffer at all
(after that TODO is done).

4 years agolib/log: typing improvements
Vladimír Čunát [Mon, 12 Jul 2021 09:27:17 +0000 (11:27 +0200)] 
lib/log: typing improvements

- const for names of log groups
- enum kr_log_group for a single log group
- the kr_log_groups bitmap doesn't need to be exposed or even exported
- return bool instead of int

4 years agologging: fix GNUTLS logging
Tomas Krizek [Thu, 8 Jul 2021 15:49:29 +0000 (17:49 +0200)] 
logging: fix GNUTLS logging

- ensure gnutls logging can be turned on/off by using GNUTLS log group
- keep TLS / TLSCLIENT as log groups for our TLS logs and use GNUTLS
  instead

4 years agologging: use LOG_GRP_HTTP for http lua module
Tomas Krizek [Thu, 8 Jul 2021 15:07:10 +0000 (17:07 +0200)] 
logging: use LOG_GRP_HTTP for http lua module

It's better to use separate log group, to separate between logs that
come from the lua module vs native C implementation. It is also more
descriptive, since http modules is used for other stuff besides its
deprecated DoH.

4 years agologging: nitpicks
Tomas Krizek [Thu, 8 Jul 2021 14:40:42 +0000 (16:40 +0200)] 
logging: nitpicks

4 years agologging: use dedicated DOTAUTH log for experimental auth DoT
Tomas Krizek [Thu, 8 Jul 2021 14:40:32 +0000 (16:40 +0200)] 
logging: use dedicated DOTAUTH log for experimental auth DoT

4 years agologging: rename *_log_groups() function to plural
Tomas Krizek [Thu, 8 Jul 2021 14:31:27 +0000 (16:31 +0200)] 
logging: rename *_log_groups() function to plural

Plural makes more sense to me here, since it can take a table with
multiple entries as input.

4 years agologging: add test for log groups
Tomas Krizek [Thu, 8 Jul 2021 11:32:37 +0000 (13:32 +0200)] 
logging: add test for log groups

Besides testing the API, running this test also ensures all log groups
have been properly defined (as long as kr_assertions are turned on).

4 years agologging: add missing LOG_GRP_PLAN
Tomas Krizek [Wed, 7 Jul 2021 15:17:55 +0000 (17:17 +0200)] 
logging: add missing LOG_GRP_PLAN

4 years agologging: fix get_log_group()
Tomas Krizek [Thu, 8 Jul 2021 11:30:22 +0000 (13:30 +0200)] 
logging: fix get_log_group()

To ensure all log groups have been properly defined, iterate over the
entire enum. If a value is missing, assert will be triggered.

Also fixes groups with number >=32 (32bit value was used to test
whether group is set before).

4 years agologging: add LOG_GRP_DEVEL
Tomas Krizek [Thu, 8 Jul 2021 11:28:11 +0000 (13:28 +0200)] 
logging: add LOG_GRP_DEVEL

This serves two purposes:

1. As a utility logger during development.
2. As the last entry in enum - to make iteration over the values
   possible. Changing the value of LOG_GRP_DEVEL shouldn't be an issue,
   since it shouldn't be used in production code.

4 years agologging: print group name padded to 6 characters
Tomas Krizek [Thu, 8 Jul 2021 01:37:43 +0000 (03:37 +0200)] 
logging: print group name padded to 6 characters

Add space padding when printing the group name to allow usage of
regular group names in lua code (e.g. "io" instead of "io    ").

4 years agologging: add get_log_group() with better API
Tomas Krizek [Wed, 7 Jul 2021 15:15:08 +0000 (17:15 +0200)] 
logging: add get_log_group() with better API

The function returns a table where key is the group name and the value
is either true (when logging selected group), or nil (when group isn't
selected).

This replaces the list_log_group() which didn't really work.

4 years agologging: ensure get/set_log_level behaves consistently
Tomas Krizek [Wed, 7 Jul 2021 13:45:26 +0000 (15:45 +0200)] 
logging: ensure get/set_log_level behaves consistently

Ensure both these functions return string that represents the log level.

Also avoid using printf - it'd probably break API when using map().

4 years agolib: make NOTICE the default log level
Tomas Krizek [Wed, 7 Jul 2021 13:22:01 +0000 (15:22 +0200)] 
lib: make NOTICE the default log level

I think notice is a good default - it should be used for scarce messages
that the user should see, while info level provides more low level info.

It could make sense to increase the log level to info if running with
journalctl (but it might be overkill).

4 years agodaemon/main: log interactive message properly
Tomas Krizek [Wed, 7 Jul 2021 13:21:41 +0000 (15:21 +0200)] 
daemon/main: log interactive message properly

4 years agolog: fix kr_log_fmt SIGSEGV crash
Lukáš Ježek [Fri, 2 Jul 2021 13:15:01 +0000 (15:15 +0200)] 
log: fix kr_log_fmt SIGSEGV crash

4 years agolog: use kr_log_debug instead kr_log_verbose
Lukáš Ježek [Fri, 2 Jul 2021 13:09:29 +0000 (15:09 +0200)] 
log: use kr_log_debug instead kr_log_verbose

4 years agolog: fix CI tests
Lukáš Ježek [Fri, 2 Jul 2021 07:32:51 +0000 (09:32 +0200)] 
log: fix CI tests

4 years agolog: lua logging
Lukáš Ježek [Thu, 24 Jun 2021 11:53:22 +0000 (13:53 +0200)] 
log: lua logging

4 years agolog: fix CI tests
Lukáš Ježek [Tue, 22 Jun 2021 12:25:42 +0000 (14:25 +0200)] 
log: fix CI tests