Commit Graph

37 Commits

Author SHA1 Message Date
47c8c5b850 mlog: Make default message handler human readable
The JSON message handler is left as a separate implementation, for any
that want to use it.
2023-09-10 15:12:30 +02:00
Brian Picciano
07f3889a70 mlog: MaxLevel method 2022-11-13 16:11:54 +01:00
Brian Picciano
ec5e2441c6 mlog: Add WithMaxLevel method 2022-11-13 16:05:23 +01:00
Brian Picciano
cbeee71cb1 Add FatalString method, make Fatal take an error 2022-05-05 19:17:45 -06:00
Brian Picciano
ba9bc6c46c refactor mlog and merr to handle and format error messages better 2021-04-09 18:05:07 -06:00
Brian Picciano
360d41e2b8 Refactor merr, remove almost everything else 2021-04-09 17:30:59 -06:00
Brian P
3e2713a850 Get rid of mcmp, and lots of subsequent refactors
Getting rid of mcmp pretty much breaks this whole package, but this
commit makes a good start on fixing all the things worth keeping.
2021-02-07 16:04:41 -07:00
Brian Picciano
1a6b8e3166 mlog: clean up component code and add tests for it 2019-06-23 11:39:36 -06:00
Brian Picciano
7a5ac9caa0 totp-proxy: refactor to use new Component logic 2019-06-17 18:18:50 -04:00
Brian Picciano
e91ef01857 m: refactor to use new Component stuff, and make the log logic a bit better 2019-06-17 17:56:14 -04:00
Brian Picciano
7eac20f58b mlog: refactor From to include Component's Context implicitly 2019-06-17 16:51:25 -04:00
Brian Picciano
8bd0664ba0 mlog: refactor to use Components instead of Contexts for storing Logger 2019-06-15 17:35:17 -06:00
Brian Picciano
f5cea76cb7 mtest/massert: rename a bunch of functions 2019-03-10 19:23:37 -04:00
Brian Picciano
e1e52db208 refactor everything to use context's annotation system, making some significant changes to annotations themselves along the way 2019-02-24 15:36:07 -05:00
Brian Picciano
4b446a0efc mctx: refactor so that contexts no longer carry mutable data
This change required refactoring nearly every package in this project,
but it does a lot to simplify mctx and make other code using it easier
to think about.

Other code, such as mlog and mcfg, had to be slightly modified for this
change to work as well.
2019-02-07 19:42:12 -05:00
Brian Picciano
15b84cb173 mlog: implement LevelFromString 2019-02-02 19:27:10 -05:00
Brian Picciano
20c6f95091 mlog: refactor to use Clone/Set instead of With pattern, implement CtxSetAll 2019-01-30 16:06:24 -05:00
Brian Picciano
a24262f295 mlog: update function docs 2019-01-25 16:39:57 -05:00
Brian Picciano
e9416dbe2a mlog: update package doc example 2019-01-25 16:29:22 -05:00
Brian Picciano
0e80e1fd3d mlog: remove ErrKV/ErrWithKV, merr.KV/merr.WithValue are used instead 2019-01-15 00:00:24 -05:00
Brian Picciano
33a10a4ac7 mlog: make the map returned from a KVer be read-only and allowed to be nil 2019-01-14 23:58:58 -05:00
Brian Picciano
1562c4e8f6 mlog: redefine KVer to return a map[string]interface, not a KV, to allow other packages to implement KVer without importing mlog 2019-01-14 23:58:55 -05:00
Brian Picciano
57db101c02 mlog: add Logger.WithKV, slightly change Message type to support it 2019-01-12 21:01:00 -05:00
Brian Picciano
0ef6997f40 mlog: fix bug which caused the DefaultHandler to not ever call Flush 2019-01-12 20:10:45 -05:00
Brian Picciano
2f647017b9 mlog: add CtxSet and From functions 2018-11-30 18:50:23 -05:00
Brian Picciano
2e269bb6e7 mlog: refactor to use a Stringer for Message.Description 2018-11-30 18:50:08 -05:00
Brian Picciano
b5c676b5c8 mlog: complete refactor again, eliminating the go-routine, which allowed a lot of other things to fall into place nicely 2018-11-30 16:27:18 -05:00
Brian Picciano
5c85969bc7 mlog: use a Clone and Set methods instead of With methods 2018-10-28 15:09:42 -04:00
Brian Picciano
d9480abb59 mlog: make stopping logic a little better 2018-10-28 14:31:40 -04:00
Brian Picciano
bc8f323514 mlog: use a waitgroup to flush the Logger on Stop 2018-08-27 15:18:38 -04:00
Brian Picciano
8368d0881b mlog: change how Merge/MergeInto work, so they don't evaluate the KV immediately 2018-07-19 18:43:17 +00:00
Brian Picciano
f0032a19d1 mlog: refactor tests to use massert 2018-07-19 18:19:26 +00:00
Brian Picciano
23d1a8fc91 mdb: implement BigQuery type, needs tests 2018-07-18 23:51:24 +00:00
Brian Picciano
6c17eaa62f mlog: implement KVerFunc and Prefix 2018-07-18 23:01:28 +00:00
Brian Picciano
15efa4ba3a mlog: refactor to handle certain use cases better, and make KV merging more consistent
Logger is now initialized with its WriteCloser (which can never change
after initialization) and then has its properties modified via method
calls. These method calls return new copies of the Logger, all writing
to the same original WriteCloser still. This allows for doing things
like having a Logger within some entity that has its own KV, for
example.

Also I revamped the merging code a bit, and fixed a precedence
inconsitency in ErrWithKV and CtxWithKV.
2018-05-28 07:53:39 +00:00
Brian Picciano
93cfa66c4b rename some mlog files, change KVer interface slightly 2018-02-15 21:23:04 +00:00
Brian Picciano
0b9c02c62a implement mlog logging system, which also implements functionality for embedding KV logging data in contexts and errors 2018-02-04 17:01:21 +00:00