1 | "use strict";
|
2 |
|
3 | var toShortString = require("type/lib/to-short-string")
|
4 | , uniGlobal = require("uni-global")("medikoo/log/202110");
|
5 |
|
6 | module.exports = function () { return uniGlobal.masterWriter || null; };
|
7 | module.exports.register = function (writer) {
|
8 | if (uniGlobal.masterWriter) {
|
9 | throw new Error("Cannot register: Master log writer already registered");
|
10 | }
|
11 | if (!writer || typeof writer.writeMessage !== "function") {
|
12 | throw new Error(toShortString(writer) + "is not a LogWriter instance");
|
13 | }
|
14 | return (uniGlobal.masterWriter = writer);
|
15 | };
|