Skip to content

Commit

Permalink
Merge branch 'colorized-logging'
Browse files Browse the repository at this point in the history
* Branch commit log:
  ase/Makefile.mk: ungroup parallel output to allow --color
  ase/logging.cc: default to colorized logs
  ase/logging: always pass location into logging functions
  ase/logging.cc: colorize log
  ase/regex: always use PCRE2
	Got rid of C++11 <regex> which is slow and lacks essentials.
  ase/regex: sub(): support PCRE2 style substitutions
  package.json, electron/main.js: fixup old log2file use
  ase/main: auto-open a log file in ~/.cache/anklang/
  ase/logging: allow logging configuration via a __weak__ log_setup() impl
  ase/logging: simplify logging to logex() and log()
  ase/: avoid global "strings.hh" include
  ase/formatter: simplify the string_format() implementation
	Breaking: treat (void*)"FOO" as pointer, not char[] string.
  misc/config-uname.mk: add -Wno-vla-cxx-extension for clang (mimick gcc)
  doc/ch-appendix.md: add todo

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Nov 18, 2024
2 parents b39578d + c622ec7 commit c8b6286
Show file tree
Hide file tree
Showing 37 changed files with 798 additions and 788 deletions.
4 changes: 2 additions & 2 deletions ase/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ lint: ase/lint
# == Check Integrity Tests ==
check-ase-tests: $(lib/AnklangSynthEngine)
$(eval xargs_parallel != P=`parallel --help 2>/dev/null` && \
[[ $$$$P =~ GNU.[Pp]arallel ]] && echo parallel || \
{ echo xargs -n1; echo "$$$$0: missing 'GNU parallel', falling back to 'xargs'" >&2; } )
[[ $$$$P =~ GNU.[Pp]arallel ]] && echo 'parallel --ungroup' || \
{ echo 'xargs -n1'; echo "$$$$0: missing 'GNU parallel', falling back to 'xargs'" >&2; } )
$(QGEN)
$Q : $(lib/AnklangSynthEngine) --check
$Q set -Eeuo pipefail \
Expand Down
1 change: 1 addition & 0 deletions ase/blob.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
#include "blob.hh"
#include "utils.hh"
#include "strings.hh"
#include "internal.hh"
#include <fcntl.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion ase/compress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static void
blake3_tests()
{
String h = string_to_hex (blake3_hash_string (""));
TASSERT (h == "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262");
TCMP (h, ==, "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262");
h = string_to_hex (blake3_hash_string ("Hello Blake3"));
TASSERT (h == "6201e8ededb2f1f2b6362119b46b404e822efbd58d7922202408025c5f527c56");
}
Expand Down
1 change: 1 addition & 0 deletions ase/crawler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "path.hh"
#include "platform.hh"
#include "unicode.hh"
#include "strings.hh"
#include "internal.hh"
#include <dirent.h>
#include <fcntl.h> // AT_NO_AUTOMOUNT
Expand Down
1 change: 1 addition & 0 deletions ase/driver-alsa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "driver.hh"
#include "datautils.hh"
#include "platform.hh"
#include "strings.hh"
#include "internal.hh"
#include <limits.h> // LONG_MAX
#include <atomic>
Expand Down
1 change: 1 addition & 0 deletions ase/driver-jack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "datautils.hh"
#include "platform.hh"
#include "internal.hh"
#include "strings.hh"
#include <unistd.h>
#include <atomic>

Expand Down
7 changes: 4 additions & 3 deletions ase/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "path.hh"
#include "platform.hh"
#include "datautils.hh"
#include "strings.hh"
#include "internal.hh"
#include <algorithm>

Expand Down Expand Up @@ -182,10 +183,10 @@ PcmDriver::open (const String &devid, IODir desired, IODir required, const PcmDr
!(entry.priority & 0x0000ffff)) // ignore secondary devices during auto-selection
{
PcmDriverP pcm_driver = RegisteredDriver<PcmDriverP>::open (entry.devid, desired, ep, opener);
loginf ("PcmDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
log ("PcmDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
if (!pcm_driver && required && desired != required) {
pcm_driver = RegisteredDriver<PcmDriverP>::open (entry.devid, required, ep, opener);
loginf ("PcmDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
log ("PcmDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
}
if (pcm_driver)
return pcm_driver;
Expand Down Expand Up @@ -242,7 +243,7 @@ MidiDriver::open (const String &devid, IODir iodir, Error *ep)
if (entry.priority < PSEUDO) // ignore pseudo devices during auto-selection
{
MidiDriverP midi_driver = RegisteredDriver<MidiDriverP>::open (entry.devid, iodir, ep, opener);
loginf ("MidiDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
log ("MidiDriver::open: devid=%s: %s\n", entry.devid, ase_error_blurb (*ep));
if (midi_driver)
return midi_driver;
}
Expand Down
3 changes: 2 additions & 1 deletion ase/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "project.hh"
#include "wave.hh"
#include "main.hh" // main_loop_autostop_mt
#include "strings.hh"
#include "memory.hh"
#include "internal.hh"

Expand Down Expand Up @@ -733,7 +734,7 @@ AudioEngine::update_drivers (const String &pcm_name, uint latency_ms, const Stri
PcmDriver::open (dset.pcm_name, Driver::WRITEONLY, Driver::WRITEONLY, pcm_config, &er);
if (!dset.pcm_driver || er != 0) {
dset.pcm_driver = dset.null_pcm_driver;
logerr ("Audio Driver", "Failed to open audio device: %s: %s", dset.pcm_name, ase_error_blurb (er));
log ("Audio Driver: Failed to open audio device: %s: %s", dset.pcm_name, ase_error_blurb (er));
const String errmsg = string_format ("# Audio I/O Error\n" "Failed to open audio device:\n" "%s:\n" "%s",
dset.pcm_name, ase_error_blurb (er));
engine_thread.queue_user_note ("driver.pcm", UserNote::CLEAR, errmsg);
Expand Down
Loading

0 comments on commit c8b6286

Please sign in to comment.