Skip to content

Commit

Permalink
docs: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed May 23, 2018
1 parent b2d706a commit 517b48d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var loggerPrototype = Object.create(
assign(
{
// Public properties & methods
// ---------------------------

// Should logger logs be exposed?
isEnabled: d("ew", true),
Expand Down Expand Up @@ -55,6 +56,8 @@ var loggerPrototype = Object.create(
disable: d(function () { return this._setEnabledState(false); }),

// Public meta methods (used by log writers)
// -----------------------------------------

isNamespaceInitialized: d("e", function (namespace) {
var namespaceTokens = ensureString(namespace).split(":");
var currentLogger = this;
Expand All @@ -79,7 +82,9 @@ var loggerPrototype = Object.create(
return objToArray(this._childNamespaceLoggers, identity);
}),

// Internal
// Internal properties and methods
// -----------------------------------------

_namespaceToken: d("", null),
_getLevelLogger: d(function (newLevel) {
newLevel = ensureString(newLevel);
Expand Down Expand Up @@ -118,6 +123,7 @@ var loggerPrototype = Object.create(
},

// Lazily resolved properties
// -----------------------------------------
lazy(
assign(
// Loggers for all levels
Expand All @@ -130,16 +136,18 @@ var loggerPrototype = Object.create(
return descriptors;
}, {}),
{
// Alias warn -> warning
// Alias `warn` to `warning`
warn: d(function () { return this._getLevelLogger("warning"); }, {
cacheName: "_warning"
}),

// Full namespace string e.g. foo:bar:elo
namespace: d(
"e",
function () { return this.namespaceTokens.join(":") || null; },
{ cacheName: "_namespace" }
),

// All namespace tokens e.g. ["foo", "bar", "elo"]
namespaceTokens: d(
"e",
Expand All @@ -152,7 +160,8 @@ var loggerPrototype = Object.create(
},
{ cacheName: "_namespaceTokens" }
),
// Map of children namespace loggers

// Internal: Map of children namespace loggers
_childNamespaceLoggers: d("", function () { return Object.create(null); }, {
cacheName: "__childNamespaceLoggers"
})
Expand Down

0 comments on commit 517b48d

Please sign in to comment.