4 Commits

Author SHA1 Message Date
Victor Vrantchan
a9900916bf Allow debug level logs at startup.
Added a -debug flag which causes the logger in main to start with debug
level logs.
2020-07-22 22:49:23 -04:00
Victor Vrantchan
ba9d2a9601 Add signal tests for main (#685)
Added tests to validate the process receiving signals:
- SIGTERM and SIGINT exit.
- SIGUSR2 swaps logs

Removed the empty Fprintln in main. Turns out stderr isn't thread safe
to write from multiple locations. The logger, which is otherwise the
only stderr writing goroutine creates a sync writer. But the stderr in
main remains unsafe. This is something to fix later?

There are also races happening with the swap log test, but only when the
test runs in parallel. I'm not sure what's happening there... added a
flag to make this test synchronous for now.

Tests that depend on signals don't run on windows. That's a big todo.
I moved SIGUSR2 behind build tags, so the binary will at least compile.
2020-07-11 14:51:31 -04:00
Victor Vrantchan
d3aadc271d log: add trace id and http request logs.
- Added the concept of a "trace id", a unique ID which gets associated
with every log/request by default. Will eventually use
opentelemetry/opentracing, or perhaps something better... Still very
alpha quality + lots of dependencies/API surface to bring in. For the
purpose of MicroMDM, a unique identifier per request is fine.

- Added HTTP logging middleware.
2020-07-05 15:04:00 -04:00
Victor Vrantchan
8763577922 add initial structure
The main change here is initializing micromdm.io as the module. That
allows micromdm to decouple from GitHub in the long run. It also means
I'll have to set up Go vanity URLs and move or modify the website
directory.

Other changes:
- WIP logging package
- Package id with ulid
- Tools repo
2020-06-27 22:57:10 -04:00