summaryrefslogtreecommitdiffstats
path: root/vendor/maunium.net/go/maulogger
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-10-27 07:08:25 -0500
committermsglm <msglm@techchud.xyz>2023-10-27 07:08:25 -0500
commit032a7e0c1188d3507b8d9a9571f2446a43cf775b (patch)
tree2bd38c01bc7761a6195e426082ce7191ebc765a1 /vendor/maunium.net/go/maulogger
parent56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (diff)
downloadmatterbridge-msglm-1.26.0+0.1.0.tar.gz
matterbridge-msglm-1.26.0+0.1.0.tar.bz2
matterbridge-msglm-1.26.0+0.1.0.zip
apply https://github.com/42wim/matterbridge/pull/1864v1.26.0+0.1.0
Diffstat (limited to 'vendor/maunium.net/go/maulogger')
-rw-r--r--vendor/maunium.net/go/maulogger/v2/LICENSE374
-rw-r--r--vendor/maunium.net/go/maulogger/v2/README.md6
-rw-r--r--vendor/maunium.net/go/maulogger/v2/defaults.go284
-rw-r--r--vendor/maunium.net/go/maulogger/v2/level.go47
-rw-r--r--vendor/maunium.net/go/maulogger/v2/logger.go224
-rw-r--r--vendor/maunium.net/go/maulogger/v2/maulogadapt/mauzerolog.go185
-rw-r--r--vendor/maunium.net/go/maulogger/v2/maulogadapt/zeromaulog.go73
-rw-r--r--vendor/maunium.net/go/maulogger/v2/sublogger.go216
-rw-r--r--vendor/maunium.net/go/maulogger/v2/writer.go78
9 files changed, 1487 insertions, 0 deletions
diff --git a/vendor/maunium.net/go/maulogger/v2/LICENSE b/vendor/maunium.net/go/maulogger/v2/LICENSE
new file mode 100644
index 00000000..52d13511
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/LICENSE
@@ -0,0 +1,374 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
diff --git a/vendor/maunium.net/go/maulogger/v2/README.md b/vendor/maunium.net/go/maulogger/v2/README.md
new file mode 100644
index 00000000..97db2f58
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/README.md
@@ -0,0 +1,6 @@
+# maulogger
+A logger in Go. Deprecated in favor of [zerolog](https://github.com/rs/zerolog).
+
+Utilities for migrating gracefully can be found in the maulogadapt package,
+it includes both wrapping a zerolog in the maulogger interface, and wrapping a
+maulogger as a zerolog output writer.
diff --git a/vendor/maunium.net/go/maulogger/v2/defaults.go b/vendor/maunium.net/go/maulogger/v2/defaults.go
new file mode 100644
index 00000000..571e79cc
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/defaults.go
@@ -0,0 +1,284 @@
+// mauLogger - A logger for Go programs
+// Copyright (c) 2016-2021 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogger
+
+import (
+ "os"
+)
+
+// DefaultLogger ...
+var DefaultLogger = Create().(*BasicLogger)
+
+// SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
+func SetWriter(w *os.File) {
+ DefaultLogger.SetWriter(w)
+}
+
+// OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
+func OpenFile() error {
+ return DefaultLogger.OpenFile()
+}
+
+// Close formats the given parts with fmt.Sprint and logs the result with the Close level
+func Close() error {
+ return DefaultLogger.Close()
+}
+
+// Sub creates a Sublogger
+func Sub(module string) Logger {
+ return DefaultLogger.Sub(module)
+}
+
+// Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
+func Rawm(level Level, metadata map[string]interface{}, module, message string) {
+ DefaultLogger.Raw(level, metadata, module, message)
+}
+
+func Raw(level Level, module, message string) {
+ DefaultLogger.Raw(level, map[string]interface{}{}, module, message)
+}
+
+// Log formats the given parts with fmt.Sprint and logs the result with the given level
+func Log(level Level, parts ...interface{}) {
+ DefaultLogger.DefaultSub.Log(level, parts...)
+}
+
+// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
+func Logln(level Level, parts ...interface{}) {
+ DefaultLogger.DefaultSub.Logln(level, parts...)
+}
+
+// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
+func Logf(level Level, message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Logf(level, message, args...)
+}
+
+// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
+func Logfln(level Level, message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Logfln(level, message, args...)
+}
+
+// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
+func Debug(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Debug(parts...)
+}
+
+// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
+func Debugln(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Debugln(parts...)
+}
+
+// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
+func Debugf(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Debugf(message, args...)
+}
+
+// Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
+func Debugfln(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Debugfln(message, args...)
+}
+
+// Info formats the given parts with fmt.Sprint and logs the result with the Info level
+func Info(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Info(parts...)
+}
+
+// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
+func Infoln(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Infoln(parts...)
+}
+
+// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
+func Infof(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Infof(message, args...)
+}
+
+// Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
+func Infofln(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Infofln(message, args...)
+}
+
+// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
+func Warn(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Warn(parts...)
+}
+
+// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
+func Warnln(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Warnln(parts...)
+}
+
+// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
+func Warnf(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Warnf(message, args...)
+}
+
+// Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
+func Warnfln(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Warnfln(message, args...)
+}
+
+// Error formats the given parts with fmt.Sprint and logs the result with the Error level
+func Error(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Error(parts...)
+}
+
+// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
+func Errorln(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Errorln(parts...)
+}
+
+// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
+func Errorf(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Errorf(message, args...)
+}
+
+// Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
+func Errorfln(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Errorfln(message, args...)
+}
+
+// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
+func Fatal(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Fatal(parts...)
+}
+
+// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
+func Fatalln(parts ...interface{}) {
+ DefaultLogger.DefaultSub.Fatalln(parts...)
+}
+
+// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
+func Fatalf(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Fatalf(message, args...)
+}
+
+// Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
+func Fatalfln(message string, args ...interface{}) {
+ DefaultLogger.DefaultSub.Fatalfln(message, args...)
+}
+
+// Log formats the given parts with fmt.Sprint and logs the result with the given level
+func (log *BasicLogger) Log(level Level, parts ...interface{}) {
+ log.DefaultSub.Log(level, parts...)
+}
+
+// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
+func (log *BasicLogger) Logln(level Level, parts ...interface{}) {
+ log.DefaultSub.Logln(level, parts...)
+}
+
+// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
+func (log *BasicLogger) Logf(level Level, message string, args ...interface{}) {
+ log.DefaultSub.Logf(level, message, args...)
+}
+
+// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
+func (log *BasicLogger) Logfln(level Level, message string, args ...interface{}) {
+ log.DefaultSub.Logfln(level, message, args...)
+}
+
+// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
+func (log *BasicLogger) Debug(parts ...interface{}) {
+ log.DefaultSub.Debug(parts...)
+}
+
+// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
+func (log *BasicLogger) Debugln(parts ...interface{}) {
+ log.DefaultSub.Debugln(parts...)
+}
+
+// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
+func (log *BasicLogger) Debugf(message string, args ...interface{}) {
+ log.DefaultSub.Debugf(message, args...)
+}
+
+// Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
+func (log *BasicLogger) Debugfln(message string, args ...interface{}) {
+ log.DefaultSub.Debugfln(message, args...)
+}
+
+// Info formats the given parts with fmt.Sprint and logs the result with the Info level
+func (log *BasicLogger) Info(parts ...interface{}) {
+ log.DefaultSub.Info(parts...)
+}
+
+// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
+func (log *BasicLogger) Infoln(parts ...interface{}) {
+ log.DefaultSub.Infoln(parts...)
+}
+
+// Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
+func (log *BasicLogger) Infofln(message string, args ...interface{}) {
+ log.DefaultSub.Infofln(message, args...)
+}
+
+// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
+func (log *BasicLogger) Infof(message string, args ...interface{}) {
+ log.DefaultSub.Infof(message, args...)
+}
+
+// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
+func (log *BasicLogger) Warn(parts ...interface{}) {
+ log.DefaultSub.Warn(parts...)
+}
+
+// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
+func (log *BasicLogger) Warnln(parts ...interface{}) {
+ log.DefaultSub.Warnln(parts...)
+}
+
+// Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
+func (log *BasicLogger) Warnfln(message string, args ...interface{}) {
+ log.DefaultSub.Warnfln(message, args...)
+}
+
+// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
+func (log *BasicLogger) Warnf(message string, args ...interface{}) {
+ log.DefaultSub.Warnf(message, args...)
+}
+
+// Error formats the given parts with fmt.Sprint and logs the result with the Error level
+func (log *BasicLogger) Error(parts ...interface{}) {
+ log.DefaultSub.Error(parts...)
+}
+
+// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
+func (log *BasicLogger) Errorln(parts ...interface{}) {
+ log.DefaultSub.Errorln(parts...)
+}
+
+// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
+func (log *BasicLogger) Errorf(message string, args ...interface{}) {
+ log.DefaultSub.Errorf(message, args...)
+}
+
+// Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
+func (log *BasicLogger) Errorfln(message string, args ...interface{}) {
+ log.DefaultSub.Errorfln(message, args...)
+}
+
+// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
+func (log *BasicLogger) Fatal(parts ...interface{}) {
+ log.DefaultSub.Fatal(parts...)
+}
+
+// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
+func (log *BasicLogger) Fatalln(parts ...interface{}) {
+ log.DefaultSub.Fatalln(parts...)
+}
+
+// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
+func (log *BasicLogger) Fatalf(message string, args ...interface{}) {
+ log.DefaultSub.Fatalf(message, args...)
+}
+
+// Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
+func (log *BasicLogger) Fatalfln(message string, args ...interface{}) {
+ log.DefaultSub.Fatalfln(message, args...)
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/level.go b/vendor/maunium.net/go/maulogger/v2/level.go
new file mode 100644
index 00000000..392dccd8
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/level.go
@@ -0,0 +1,47 @@
+// mauLogger - A logger for Go programs
+// Copyright (c) 2016-2021 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogger
+
+import (
+ "fmt"
+)
+
+// Level is the severity level of a log entry.
+type Level struct {
+ Name string
+ Severity, Color int
+}
+
+var (
+ // LevelDebug is the level for debug messages.
+ LevelDebug = Level{Name: "DEBUG", Color: -1, Severity: 0}
+ // LevelInfo is the level for basic log messages.
+ LevelInfo = Level{Name: "INFO", Color: 36, Severity: 10}
+ // LevelWarn is the level saying that something went wrong, but the program will continue operating mostly normally.
+ LevelWarn = Level{Name: "WARN", Color: 33, Severity: 50}
+ // LevelError is the level saying that something went wrong and the program may not operate as expected, but will still continue.
+ LevelError = Level{Name: "ERROR", Color: 31, Severity: 100}
+ // LevelFatal is the level saying that something went wrong and the program will not operate normally.
+ LevelFatal = Level{Name: "FATAL", Color: 35, Severity: 9001}
+)
+
+// GetColor gets the ANSI escape color code for the log level.
+func (lvl Level) GetColor() string {
+ if lvl.Color < 0 {
+ return "\x1b[0m"
+ }
+ return fmt.Sprintf("\x1b[%dm", lvl.Color)
+}
+
+// GetReset gets the ANSI escape reset code.
+func (lvl Level) GetReset() string {
+ if lvl.Color < 0 {
+ return ""
+ }
+ return "\x1b[0m"
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/logger.go b/vendor/maunium.net/go/maulogger/v2/logger.go
new file mode 100644
index 00000000..61cd1e1d
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/logger.go
@@ -0,0 +1,224 @@
+// mauLogger - A logger for Go programs
+// Copyright (c) 2016-2021 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogger
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+ "os"
+ "strings"
+ "sync"
+ "time"
+)
+
+// LoggerFileFormat ...
+type LoggerFileFormat func(now string, i int) string
+
+type BasicLogger struct {
+ PrintLevel int
+ FlushLineThreshold int
+ FileTimeFormat string
+ FileFormat LoggerFileFormat
+ TimeFormat string
+ FileMode os.FileMode
+ DefaultSub Logger
+
+ JSONFile bool
+ JSONStdout bool
+
+ stdoutEncoder *json.Encoder
+ fileEncoder *json.Encoder
+
+ writer *os.File
+ writerLock sync.Mutex
+ StdoutLock sync.Mutex
+ StderrLock sync.Mutex
+ lines int
+
+ metadata map[string]interface{}
+}
+
+// Logger contains advanced logging functions
+type Logger interface {
+ Sub(module string) Logger
+ Subm(module string, metadata map[string]interface{}) Logger
+ WithDefaultLevel(level Level) Logger
+ GetParent() Logger
+
+ Writer(level Level) io.WriteCloser
+
+ Log(level Level, parts ...interface{})
+ Logln(level Level, parts ...interface{})
+ Logf(level Level, message string, args ...interface{})
+ Logfln(level Level, message string, args ...interface{})
+
+ Debug(parts ...interface{})
+ Debugln(parts ...interface{})
+ Debugf(message string, args ...interface{})
+ Debugfln(message string, args ...interface{})
+ Info(parts ...interface{})
+ Infoln(parts ...interface{})
+ Infof(message string, args ...interface{})
+ Infofln(message string, args ...interface{})
+ Warn(parts ...interface{})
+ Warnln(parts ...interface{})
+ Warnf(message string, args ...interface{})
+ Warnfln(message string, args ...interface{})
+ Error(parts ...interface{})
+ Errorln(parts ...interface{})
+ Errorf(message string, args ...interface{})
+ Errorfln(message string, args ...interface{})
+ Fatal(parts ...interface{})
+ Fatalln(parts ...interface{})
+ Fatalf(message string, args ...interface{})
+ Fatalfln(message string, args ...interface{})
+}
+
+// Create a Logger
+func Createm(metadata map[string]interface{}) Logger {
+ var log = &BasicLogger{
+ PrintLevel: 10,
+ FileTimeFormat: "2006-01-02",
+ FileFormat: func(now string, i int) string { return fmt.Sprintf("%[1]s-%02[2]d.log", now, i) },
+ TimeFormat: "15:04:05 02.01.2006",
+ FileMode: 0600,
+ FlushLineThreshold: 5,
+ lines: 0,
+ metadata: metadata,
+ }
+ log.DefaultSub = log.Sub("")
+ return log
+}
+
+func Create() Logger {
+ return Createm(map[string]interface{}{})
+}
+
+func (log *BasicLogger) EnableJSONStdout() {
+ log.JSONStdout = true
+ log.stdoutEncoder = json.NewEncoder(os.Stdout)
+}
+
+func (log *BasicLogger) GetParent() Logger {
+ return nil
+}
+
+// SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
+func (log *BasicLogger) SetWriter(w *os.File) {
+ log.writer = w
+ if log.JSONFile {
+ log.fileEncoder = json.NewEncoder(w)
+ }
+}
+
+// OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
+func (log *BasicLogger) OpenFile() error {
+ now := time.Now().Format(log.FileTimeFormat)
+ i := 1
+ for ; ; i++ {
+ if _, err := os.Stat(log.FileFormat(now, i)); os.IsNotExist(err) {
+ break
+ }
+ }
+ writer, err := os.OpenFile(log.FileFormat(now, i), os.O_WRONLY|os.O_CREATE|os.O_APPEND, log.FileMode)
+ if err != nil {
+ return err
+ } else if writer == nil {
+ return os.ErrInvalid
+ }
+ log.SetWriter(writer)
+ return nil
+}
+
+// Close formats the given parts with fmt.Sprint and logs the result with the Close level
+func (log *BasicLogger) Close() error {
+ if log.writer != nil {
+ return log.writer.Close()
+ }
+ return nil
+}
+
+type logLine struct {
+ log *BasicLogger
+
+ Command string `json:"command"`
+ Time time.Time `json:"time"`
+ Level string `json:"level"`
+ Module string `json:"module"`
+ Message string `json:"message"`
+ Metadata map[string]interface{} `json:"metadata"`
+}
+
+func (ll logLine) String() string {
+ if len(ll.Module) == 0 {
+ return fmt.Sprintf("[%s] [%s] %s", ll.Time.Format(ll.log.TimeFormat), ll.Level, ll.Message)
+ } else {
+ return fmt.Sprintf("[%s] [%s/%s] %s", ll.Time.Format(ll.log.TimeFormat), ll.Module, ll.Level, ll.Message)
+ }
+}
+
+func reduceItem(m1, m2 map[string]interface{}) map[string]interface{} {
+ m3 := map[string]interface{}{}
+
+ _merge := func(m map[string]interface{}) {
+ for ia, va := range m {
+ m3[ia] = va
+ }
+ }
+
+ _merge(m1)
+ _merge(m2)
+
+ return m3
+}
+
+// Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
+func (log *BasicLogger) Raw(level Level, extraMetadata map[string]interface{}, module, origMessage string) {
+ message := logLine{log, "log", time.Now(), level.Name, module, strings.TrimSpace(origMessage), reduceItem(log.metadata, extraMetadata)}
+
+ if log.writer != nil {
+ log.writerLock.Lock()
+ var err error
+ if log.JSONFile {
+ err = log.fileEncoder.Encode(&message)
+ } else {
+ _, err = log.writer.WriteString(message.String())
+ _, _ = log.writer.WriteString("\n")
+ }
+ log.writerLock.Unlock()
+ if err != nil {
+ log.StderrLock.Lock()
+ _, _ = os.Stderr.WriteString("Failed to write to log file:")
+ _, _ = os.Stderr.WriteString(err.Error())
+ log.StderrLock.Unlock()
+ }
+ }
+
+ if level.Severity >= log.PrintLevel {
+ if log.JSONStdout {
+ log.StdoutLock.Lock()
+ _ = log.stdoutEncoder.Encode(&message)
+ log.StdoutLock.Unlock()
+ } else if level.Severity >= LevelError.Severity {
+ log.StderrLock.Lock()
+ _, _ = os.Stderr.WriteString(level.GetColor())
+ _, _ = os.Stderr.WriteString(message.String())
+ _, _ = os.Stderr.WriteString(level.GetReset())
+ _, _ = os.Stderr.WriteString("\n")
+ log.StderrLock.Unlock()
+ } else {
+ log.StdoutLock.Lock()
+ _, _ = os.Stdout.WriteString(level.GetColor())
+ _, _ = os.Stdout.WriteString(message.String())
+ _, _ = os.Stdout.WriteString(level.GetReset())
+ _, _ = os.Stdout.WriteString("\n")
+ log.StdoutLock.Unlock()
+ }
+ }
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/maulogadapt/mauzerolog.go b/vendor/maunium.net/go/maulogger/v2/maulogadapt/mauzerolog.go
new file mode 100644
index 00000000..774c189e
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/maulogadapt/mauzerolog.go
@@ -0,0 +1,185 @@
+// Copyright (c) 2023 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogadapt
+
+import (
+ "fmt"
+ "io"
+ "strings"
+
+ "github.com/rs/zerolog"
+
+ "maunium.net/go/maulogger/v2"
+)
+
+type MauZeroLog struct {
+ *zerolog.Logger
+ orig *zerolog.Logger
+ mod string
+}
+
+func ZeroAsMau(log *zerolog.Logger) maulogger.Logger {
+ return MauZeroLog{log, log, ""}
+}
+
+var _ maulogger.Logger = (*MauZeroLog)(nil)
+
+func (m MauZeroLog) Sub(module string) maulogger.Logger {
+ return m.Subm(module, map[string]interface{}{})
+}
+
+func (m MauZeroLog) Subm(module string, metadata map[string]interface{}) maulogger.Logger {
+ if m.mod != "" {
+ module = fmt.Sprintf("%s/%s", m.mod, module)
+ }
+ var orig zerolog.Logger
+ if m.orig != nil {
+ orig = *m.orig
+ } else {
+ orig = *m.Logger
+ }
+ if len(metadata) > 0 {
+ with := m.orig.With()
+ for key, value := range metadata {
+ with = with.Interface(key, value)
+ }
+ orig = with.Logger()
+ }
+ log := orig.With().Str("module", module).Logger()
+ return MauZeroLog{&log, &orig, module}
+}
+
+func (m MauZeroLog) WithDefaultLevel(_ maulogger.Level) maulogger.Logger {
+ return m
+}
+
+func (m MauZeroLog) GetParent() maulogger.Logger {
+ return nil
+}
+
+type nopWriteCloser struct {
+ io.Writer
+}
+
+func (nopWriteCloser) Close() error { return nil }
+
+func (m MauZeroLog) Writer(level maulogger.Level) io.WriteCloser {
+ return nopWriteCloser{m.Logger.With().Str(zerolog.LevelFieldName, zerolog.LevelFieldMarshalFunc(mauToZeroLevel(level))).Logger()}
+}
+
+func mauToZeroLevel(level maulogger.Level) zerolog.Level {
+ switch level {
+ case maulogger.LevelDebug:
+ return zerolog.DebugLevel
+ case maulogger.LevelInfo:
+ return zerolog.InfoLevel
+ case maulogger.LevelWarn:
+ return zerolog.WarnLevel
+ case maulogger.LevelError:
+ return zerolog.ErrorLevel
+ case maulogger.LevelFatal:
+ return zerolog.FatalLevel
+ default:
+ return zerolog.TraceLevel
+ }
+}
+
+func (m MauZeroLog) Log(level maulogger.Level, parts ...interface{}) {
+ m.Logger.WithLevel(mauToZeroLevel(level)).Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Logln(level maulogger.Level, parts ...interface{}) {
+ m.Logger.WithLevel(mauToZeroLevel(level)).Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Logf(level maulogger.Level, message string, args ...interface{}) {
+ m.Logger.WithLevel(mauToZeroLevel(level)).Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Logfln(level maulogger.Level, message string, args ...interface{}) {
+ m.Logger.WithLevel(mauToZeroLevel(level)).Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Debug(parts ...interface{}) {
+ m.Logger.Debug().Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Debugln(parts ...interface{}) {
+ m.Logger.Debug().Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Debugf(message string, args ...interface{}) {
+ m.Logger.Debug().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Debugfln(message string, args ...interface{}) {
+ m.Logger.Debug().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Info(parts ...interface{}) {
+ m.Logger.Info().Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Infoln(parts ...interface{}) {
+ m.Logger.Info().Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Infof(message string, args ...interface{}) {
+ m.Logger.Info().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Infofln(message string, args ...interface{}) {
+ m.Logger.Info().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Warn(parts ...interface{}) {
+ m.Logger.Warn().Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Warnln(parts ...interface{}) {
+ m.Logger.Warn().Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Warnf(message string, args ...interface{}) {
+ m.Logger.Warn().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Warnfln(message string, args ...interface{}) {
+ m.Logger.Warn().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Error(parts ...interface{}) {
+ m.Logger.Error().Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Errorln(parts ...interface{}) {
+ m.Logger.Error().Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Errorf(message string, args ...interface{}) {
+ m.Logger.Error().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Errorfln(message string, args ...interface{}) {
+ m.Logger.Error().Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Fatal(parts ...interface{}) {
+ m.Logger.WithLevel(zerolog.FatalLevel).Msg(fmt.Sprint(parts...))
+}
+
+func (m MauZeroLog) Fatalln(parts ...interface{}) {
+ m.Logger.WithLevel(zerolog.FatalLevel).Msg(strings.TrimSuffix(fmt.Sprintln(parts...), "\n"))
+}
+
+func (m MauZeroLog) Fatalf(message string, args ...interface{}) {
+ m.Logger.WithLevel(zerolog.FatalLevel).Msg(fmt.Sprintf(message, args...))
+}
+
+func (m MauZeroLog) Fatalfln(message string, args ...interface{}) {
+ m.Logger.WithLevel(zerolog.FatalLevel).Msg(fmt.Sprintf(message, args...))
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/maulogadapt/zeromaulog.go b/vendor/maunium.net/go/maulogger/v2/maulogadapt/zeromaulog.go
new file mode 100644
index 00000000..1a275e7d
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/maulogadapt/zeromaulog.go
@@ -0,0 +1,73 @@
+// Copyright (c) 2023 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogadapt
+
+import (
+ "bytes"
+
+ "github.com/rs/zerolog"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+
+ "maunium.net/go/maulogger/v2"
+)
+
+// ZeroMauLog is a simple wrapper for a maulogger that can be set as the output writer for zerolog.
+type ZeroMauLog struct {
+ maulogger.Logger
+}
+
+func MauAsZero(log maulogger.Logger) *zerolog.Logger {
+ zero := zerolog.New(&ZeroMauLog{log})
+ return &zero
+}
+
+var _ zerolog.LevelWriter = (*ZeroMauLog)(nil)
+
+func (z *ZeroMauLog) Write(p []byte) (n int, err error) {
+ return 0, nil
+}
+
+func (z *ZeroMauLog) WriteLevel(level zerolog.Level, p []byte) (n int, err error) {
+ var mauLevel maulogger.Level
+ switch level {
+ case zerolog.DebugLevel:
+ mauLevel = maulogger.LevelDebug
+ case zerolog.InfoLevel, zerolog.NoLevel:
+ mauLevel = maulogger.LevelInfo
+ case zerolog.WarnLevel:
+ mauLevel = maulogger.LevelWarn
+ case zerolog.ErrorLevel:
+ mauLevel = maulogger.LevelError
+ case zerolog.FatalLevel, zerolog.PanicLevel:
+ mauLevel = maulogger.LevelFatal
+ case zerolog.Disabled, zerolog.TraceLevel:
+ fallthrough
+ default:
+ return 0, nil
+ }
+ p = bytes.TrimSuffix(p, []byte{'\n'})
+ msg := gjson.GetBytes(p, zerolog.MessageFieldName).Str
+
+ p, err = sjson.DeleteBytes(p, zerolog.MessageFieldName)
+ if err != nil {
+ return
+ }
+ p, err = sjson.DeleteBytes(p, zerolog.LevelFieldName)
+ if err != nil {
+ return
+ }
+ p, err = sjson.DeleteBytes(p, zerolog.TimestampFieldName)
+ if err != nil {
+ return
+ }
+ if len(p) > 2 {
+ msg += " " + string(p)
+ }
+ z.Log(mauLevel, msg)
+ return len(p), nil
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/sublogger.go b/vendor/maunium.net/go/maulogger/v2/sublogger.go
new file mode 100644
index 00000000..b3326908
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/sublogger.go
@@ -0,0 +1,216 @@
+// mauLogger - A logger for Go programs
+// Copyright (c) 2016-2021 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogger
+
+import (
+ "fmt"
+)
+
+type Sublogger struct {
+ topLevel *BasicLogger
+ parent Logger
+ Module string
+ DefaultLevel Level
+ metadata map[string]interface{}
+}
+
+// Subm creates a Sublogger
+func (log *BasicLogger) Subm(module string, metadata map[string]interface{}) Logger {
+ return &Sublogger{
+ topLevel: log,
+ parent: log,
+ Module: module,
+ DefaultLevel: LevelInfo,
+ metadata: metadata,
+ }
+}
+
+func (log *BasicLogger) Sub(module string) Logger {
+ return log.Subm(module, map[string]interface{}{})
+}
+
+// WithDefaultLevel creates a Sublogger with the same Module but different DefaultLevel
+func (log *BasicLogger) WithDefaultLevel(lvl Level) Logger {
+ return log.DefaultSub.WithDefaultLevel(lvl)
+}
+
+func (log *Sublogger) GetParent() Logger {
+ return log.parent
+}
+
+// Sub creates a Sublogger
+func (log *Sublogger) Subm(module string, metadata map[string]interface{}) Logger {
+ if len(module) > 0 {
+ module = fmt.Sprintf("%s/%s", log.Module, module)
+ } else {
+ module = log.Module
+ }
+
+ return &Sublogger{
+ topLevel: log.topLevel,
+ parent: log,
+ Module: module,
+ DefaultLevel: log.DefaultLevel,
+ metadata: metadata,
+ }
+}
+
+func (log *Sublogger) Sub(module string) Logger {
+ return log.Subm(module, map[string]interface{}{})
+}
+
+// WithDefaultLevel creates a Sublogger with the same Module but different DefaultLevel
+func (log *Sublogger) WithDefaultLevel(lvl Level) Logger {
+ return &Sublogger{
+ topLevel: log.topLevel,
+ parent: log.parent,
+ Module: log.Module,
+ DefaultLevel: lvl,
+ }
+}
+
+// SetModule changes the module name of this Sublogger
+func (log *Sublogger) SetModule(mod string) {
+ log.Module = mod
+}
+
+// SetDefaultLevel changes the default logging level of this Sublogger
+func (log *Sublogger) SetDefaultLevel(lvl Level) {
+ log.DefaultLevel = lvl
+}
+
+// SetParent changes the parent of this Sublogger
+func (log *Sublogger) SetParent(parent *BasicLogger) {
+ log.topLevel = parent
+}
+
+//Write ...
+func (log *Sublogger) Write(p []byte) (n int, err error) {
+ log.topLevel.Raw(log.DefaultLevel, log.metadata, log.Module, string(p))
+ return len(p), nil
+}
+
+// Log formats the given parts with fmt.Sprint and logs the result with the given level
+func (log *Sublogger) Log(level Level, parts ...interface{}) {
+ log.topLevel.Raw(level, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
+func (log *Sublogger) Logln(level Level, parts ...interface{}) {
+ log.topLevel.Raw(level, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
+func (log *Sublogger) Logf(level Level, message string, args ...interface{}) {
+ log.topLevel.Raw(level, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
+func (log *Sublogger) Logfln(level Level, message string, args ...interface{}) {
+ log.topLevel.Raw(level, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
+
+// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
+func (log *Sublogger) Debug(parts ...interface{}) {
+ log.topLevel.Raw(LevelDebug, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
+func (log *Sublogger) Debugln(parts ...interface{}) {
+ log.topLevel.Raw(LevelDebug, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
+func (log *Sublogger) Debugf(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelDebug, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
+func (log *Sublogger) Debugfln(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelDebug, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
+
+// Info formats the given parts with fmt.Sprint and logs the result with the Info level
+func (log *Sublogger) Info(parts ...interface{}) {
+ log.topLevel.Raw(LevelInfo, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
+func (log *Sublogger) Infoln(parts ...interface{}) {
+ log.topLevel.Raw(LevelInfo, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
+func (log *Sublogger) Infof(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelInfo, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
+func (log *Sublogger) Infofln(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelInfo, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
+
+// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
+func (log *Sublogger) Warn(parts ...interface{}) {
+ log.topLevel.Raw(LevelWarn, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
+func (log *Sublogger) Warnln(parts ...interface{}) {
+ log.topLevel.Raw(LevelWarn, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
+func (log *Sublogger) Warnf(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelWarn, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
+func (log *Sublogger) Warnfln(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelWarn, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
+
+// Error formats the given parts with fmt.Sprint and logs the result with the Error level
+func (log *Sublogger) Error(parts ...interface{}) {
+ log.topLevel.Raw(LevelError, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
+func (log *Sublogger) Errorln(parts ...interface{}) {
+ log.topLevel.Raw(LevelError, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
+func (log *Sublogger) Errorf(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelError, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
+func (log *Sublogger) Errorfln(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelError, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
+
+// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
+func (log *Sublogger) Fatal(parts ...interface{}) {
+ log.topLevel.Raw(LevelFatal, log.metadata, log.Module, fmt.Sprint(parts...))
+}
+
+// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
+func (log *Sublogger) Fatalln(parts ...interface{}) {
+ log.topLevel.Raw(LevelFatal, log.metadata, log.Module, fmt.Sprintln(parts...))
+}
+
+// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
+func (log *Sublogger) Fatalf(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelFatal, log.metadata, log.Module, fmt.Sprintf(message, args...))
+}
+
+// Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
+func (log *Sublogger) Fatalfln(message string, args ...interface{}) {
+ log.topLevel.Raw(LevelFatal, log.metadata, log.Module, fmt.Sprintf(message+"\n", args...))
+}
diff --git a/vendor/maunium.net/go/maulogger/v2/writer.go b/vendor/maunium.net/go/maulogger/v2/writer.go
new file mode 100644
index 00000000..8852b857
--- /dev/null
+++ b/vendor/maunium.net/go/maulogger/v2/writer.go
@@ -0,0 +1,78 @@
+// mauLogger - A logger for Go programs
+// Copyright (c) 2021 Tulir Asokan
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+package maulogger
+
+import (
+ "bytes"
+ "io"
+ "sync"
+)
+
+// LogWriter is a buffered io.Writer that writes lines to a Logger.
+type LogWriter struct {
+ log Logger
+ lock sync.Mutex
+ level Level
+ buf bytes.Buffer
+}
+
+func (log *BasicLogger) Writer(level Level) io.WriteCloser {
+ return &LogWriter{
+ log: log,
+ level: level,
+ }
+}
+
+func (log *Sublogger) Writer(level Level) io.WriteCloser {
+ return &LogWriter{
+ log: log,
+ level: level,
+ }
+}
+
+func (lw *LogWriter) writeLine(data []byte) {
+ if lw.buf.Len() == 0 {
+ if len(data) == 0 {
+ return
+ }
+ lw.log.Logln(lw.level, string(data))
+ } else {
+ lw.buf.Write(data)
+ lw.log.Logln(lw.level, lw.buf.String())
+ lw.buf.Reset()
+ }
+}
+
+// Write will write lines from the given data to the buffer. If the data doesn't end with a line break,
+// everything after the last line break will be buffered until the next Write or Close call.
+func (lw *LogWriter) Write(data []byte) (int, error) {
+ lw.lock.Lock()
+ newline := bytes.IndexByte(data, '\n')
+ if newline == len(data)-1 {
+ lw.writeLine(data[:len(data)-1])
+ } else if newline < 0 {
+ lw.buf.Write(data)
+ } else {
+ lines := bytes.Split(data, []byte("\n"))
+ for _, line := range lines[:len(lines)-1] {
+ lw.writeLine(line)
+ }
+ lw.buf.Write(lines[len(lines)-1])
+ }
+ lw.lock.Unlock()
+ return len(data), nil
+}
+
+// Close will flush remaining data in the buffer into the logger.
+func (lw *LogWriter) Close() error {
+ lw.lock.Lock()
+ lw.log.Logln(lw.level, lw.buf.String())
+ lw.buf.Reset()
+ lw.lock.Unlock()
+ return nil
+}