kerium 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/log.d.ts CHANGED
@@ -2,7 +2,7 @@ import { List } from 'utilium';
2
2
  /**
3
3
  * The log levels
4
4
  */
5
- export declare const enum Level {
5
+ export declare enum Level {
6
6
  /** Emergency */
7
7
  EMERG = 0,
8
8
  /** Alert */
package/dist/log.js CHANGED
@@ -1,5 +1,27 @@
1
1
  /* Logging utilities. The things in this file are named to work nicely when you import as a namespace. */
2
2
  import { List } from 'utilium';
3
+ /**
4
+ * The log levels
5
+ */
6
+ export var Level;
7
+ (function (Level) {
8
+ /** Emergency */
9
+ Level[Level["EMERG"] = 0] = "EMERG";
10
+ /** Alert */
11
+ Level[Level["ALERT"] = 1] = "ALERT";
12
+ /** Critical */
13
+ Level[Level["CRIT"] = 2] = "CRIT";
14
+ /** Error */
15
+ Level[Level["ERR"] = 3] = "ERR";
16
+ /** Warning */
17
+ Level[Level["WARN"] = 4] = "WARN";
18
+ /** Notice */
19
+ Level[Level["NOTICE"] = 5] = "NOTICE";
20
+ /** Informational */
21
+ Level[Level["INFO"] = 6] = "INFO";
22
+ /** Debug */
23
+ Level[Level["DEBUG"] = 7] = "DEBUG";
24
+ })(Level || (Level = {}));
3
25
  /** An object mapping log levels to a textual representation of them */
4
26
  export const levels = [
5
27
  'emergency',
@@ -39,27 +61,27 @@ function _shortcut(level) {
39
61
  }
40
62
  // Shortcuts
41
63
  /** Shortcut for logging emergencies */
42
- export const emerg = _shortcut(0 /* Level.EMERG */);
64
+ export const emerg = _shortcut(Level.EMERG);
43
65
  /** Shortcut for logging alerts */
44
- export const alert = _shortcut(1 /* Level.ALERT */);
66
+ export const alert = _shortcut(Level.ALERT);
45
67
  /** Shortcut for logging critical errors */
46
- export const crit = _shortcut(2 /* Level.CRIT */);
68
+ export const crit = _shortcut(Level.CRIT);
47
69
  /** Shortcut for logging non-critical errors */
48
- export const err = _shortcut(3 /* Level.ERR */);
70
+ export const err = _shortcut(Level.ERR);
49
71
  /** Shortcut for logging warnings */
50
- export const warn = _shortcut(4 /* Level.WARN */);
72
+ export const warn = _shortcut(Level.WARN);
51
73
  /** Shortcut for logging notices */
52
- export const notice = _shortcut(5 /* Level.NOTICE */);
74
+ export const notice = _shortcut(Level.NOTICE);
53
75
  /** Shortcut for logging informational messages */
54
- export const info = _shortcut(6 /* Level.INFO */);
76
+ export const info = _shortcut(Level.INFO);
55
77
  /** Shortcut for logging debug messages */
56
- export const debug = _shortcut(7 /* Level.DEBUG */);
78
+ export const debug = _shortcut(Level.DEBUG);
57
79
  /**
58
80
  * Shortcut for logging usage of deprecated functions at runtime
59
81
  * @param symbol The thing that is deprecated
60
82
  */
61
83
  export function deprecated(symbol) {
62
- log(4 /* Level.WARN */, symbol + ' is deprecated and should not be used.');
84
+ log(Level.WARN, symbol + ' is deprecated and should not be used.');
63
85
  }
64
86
  // Formatting and output
65
87
  function ansi(text, format) {
@@ -78,46 +100,46 @@ function _prettyMs(entry, style) {
78
100
  }
79
101
  const levelColor = {
80
102
  ansi: {
81
- [0 /* Level.EMERG */]: '1;4;37;41',
82
- [1 /* Level.ALERT */]: '1;37;41',
83
- [2 /* Level.CRIT */]: '1;35',
84
- [3 /* Level.ERR */]: '1;31',
85
- [4 /* Level.WARN */]: '1;33',
86
- [5 /* Level.NOTICE */]: '1;36',
87
- [6 /* Level.INFO */]: '1;37',
88
- [7 /* Level.DEBUG */]: '0;2;37',
103
+ [Level.EMERG]: '1;4;37;41',
104
+ [Level.ALERT]: '1;37;41',
105
+ [Level.CRIT]: '1;35',
106
+ [Level.ERR]: '1;31',
107
+ [Level.WARN]: '1;33',
108
+ [Level.NOTICE]: '1;36',
109
+ [Level.INFO]: '1;37',
110
+ [Level.DEBUG]: '0;2;37',
89
111
  },
90
112
  css: {
91
- [0 /* Level.EMERG */]: 'font-weight: bold; text-decoration: underline; color: white; background-color: red;',
92
- [1 /* Level.ALERT */]: 'font-weight: bold; color: white; background-color: red;',
93
- [2 /* Level.CRIT */]: 'font-weight: bold; color: magenta;',
94
- [3 /* Level.ERR */]: 'font-weight: bold; color: red;',
95
- [4 /* Level.WARN */]: 'font-weight: bold; color: yellow;',
96
- [5 /* Level.NOTICE */]: 'font-weight: bold; color: cyan;',
97
- [6 /* Level.INFO */]: 'font-weight: bold; color: white;',
98
- [7 /* Level.DEBUG */]: 'opacity: 0.8; color: white;',
113
+ [Level.EMERG]: 'font-weight: bold; text-decoration: underline; color: white; background-color: red;',
114
+ [Level.ALERT]: 'font-weight: bold; color: white; background-color: red;',
115
+ [Level.CRIT]: 'font-weight: bold; color: magenta;',
116
+ [Level.ERR]: 'font-weight: bold; color: red;',
117
+ [Level.WARN]: 'font-weight: bold; color: yellow;',
118
+ [Level.NOTICE]: 'font-weight: bold; color: cyan;',
119
+ [Level.INFO]: 'font-weight: bold; color: white;',
120
+ [Level.DEBUG]: 'opacity: 0.8; color: white;',
99
121
  },
100
122
  };
101
123
  const messageColor = {
102
124
  ansi: {
103
- [0 /* Level.EMERG */]: '1;31',
104
- [1 /* Level.ALERT */]: '1;31',
105
- [2 /* Level.CRIT */]: '1;31',
106
- [3 /* Level.ERR */]: '31',
107
- [4 /* Level.WARN */]: '33',
108
- [5 /* Level.NOTICE */]: '1;37',
109
- [6 /* Level.INFO */]: '37',
110
- [7 /* Level.DEBUG */]: '2;37',
125
+ [Level.EMERG]: '1;31',
126
+ [Level.ALERT]: '1;31',
127
+ [Level.CRIT]: '1;31',
128
+ [Level.ERR]: '31',
129
+ [Level.WARN]: '33',
130
+ [Level.NOTICE]: '1;37',
131
+ [Level.INFO]: '37',
132
+ [Level.DEBUG]: '2;37',
111
133
  },
112
134
  css: {
113
- [0 /* Level.EMERG */]: 'font-weight: bold; color: red;',
114
- [1 /* Level.ALERT */]: 'font-weight: bold; color: red;',
115
- [2 /* Level.CRIT */]: 'font-weight: bold; color: red;',
116
- [3 /* Level.ERR */]: 'color: red;',
117
- [4 /* Level.WARN */]: 'color: yellow;',
118
- [5 /* Level.NOTICE */]: 'font-weight: bold; color: white;',
119
- [6 /* Level.INFO */]: 'color: white;',
120
- [7 /* Level.DEBUG */]: 'opacity: 0.8; color: white;',
135
+ [Level.EMERG]: 'font-weight: bold; color: red;',
136
+ [Level.ALERT]: 'font-weight: bold; color: red;',
137
+ [Level.CRIT]: 'font-weight: bold; color: red;',
138
+ [Level.ERR]: 'color: red;',
139
+ [Level.WARN]: 'color: yellow;',
140
+ [Level.NOTICE]: 'font-weight: bold; color: white;',
141
+ [Level.INFO]: 'color: white;',
142
+ [Level.DEBUG]: 'opacity: 0.8; color: white;',
121
143
  },
122
144
  };
123
145
  /**
@@ -135,7 +157,7 @@ export function fancy({ style, colorize }) {
135
157
  yield entry.message;
136
158
  return;
137
159
  }
138
- if (entry.level < 2 /* Level.CRIT */) {
160
+ if (entry.level < Level.CRIT) {
139
161
  yield* levelText;
140
162
  yield ': ';
141
163
  }
@@ -156,7 +178,7 @@ function output(entry) {
156
178
  return;
157
179
  _output(...format(entry));
158
180
  }
159
- let minLevel = 1 /* Level.ALERT */;
181
+ let minLevel = Level.ALERT;
160
182
  let includeStack = false;
161
183
  // Configuration
162
184
  /** Whether log entries are being recorded */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kerium",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "POSIX-style errors, logging, and more",
5
5
  "author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
6
6
  "repository": {