Software /
code /
prosody
Annotate
teal-src/util/logger.d.tl @ 12749:eb9814372c54
util.promise: Remove some redundant checks, add tests confirming redundancy
This lines don't appear to do anything useful, and all tests pass when they
are removed. Discovered via mutation testing.
I added extra tests to exercise this code, because I wasn't certain that there
were no side-effects caused by removal. Everything appears to be fine, thanks
to the "pending" check at the start of promise_settle().
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 07 Oct 2022 17:43:26 +0100 |
parent | 12621:041d067de38b |
rev | line source |
---|---|
12621
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local record util |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 enum loglevel |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 "debug" |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 "info" |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 "warn" |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 "error" |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 end |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 type logger = function ( loglevel, string, ...:any ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 type sink = function ( string, loglevel, string, ...:any ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 type simple_sink = function ( string, loglevel, string ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 init : function ( string ) : logger |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 make_logger : function ( string, loglevel ) : function ( string, ...:any ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 reset : function () |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 add_level_sink : function ( loglevel, sink ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 add_simple_sink : function ( simple_sink, { loglevel } ) |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 end |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 |
041d067de38b
util.logger: Add Teal interface description
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 return util |