@zimtsui/typelog 0.0.8 → 0.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zimtsui/typelog",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "exports": {
5
5
  ".": "./build/typelog.js",
6
6
  "./typed-events": "./build/typed-events.js",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "https://github.com/zimtsui/typelog"
19
+ "url": "git+https://github.com/zimtsui/typelog.git"
20
20
  },
21
21
  "author": "Zim",
22
22
  "dependencies": {
package/examples/basic.ts DELETED
@@ -1,29 +0,0 @@
1
- import { Channel } from '@zimtsui/typelog';
2
- import { stderr } from 'node:process';
3
-
4
- // Declare all log levels whose values are sorted from verbose to severe.
5
- enum Level { trace, debug, info, warn, error }
6
-
7
- // Declare log levels for different environments.
8
- const envlevels: Record<string, Level> = {
9
- debug: Level.trace,
10
- development: Level.debug,
11
- production: Level.warn,
12
- };
13
-
14
- // Determine the log level according to the environment variable.
15
- const envLevel = envlevels[process.env.NODE_ENV ?? ''] ?? Level.info;
16
-
17
- // Create loggers.
18
- const logger = {
19
- verbatim: Channel.create<typeof Level, string>(Level, (message, level) => {
20
- if (level >= envLevel) stderr.write(message);
21
- }),
22
- pretty: Channel.create<Record<keyof typeof Level, Level>, unknown>(Level, (message, level) => {
23
- if (level >= envLevel) console.error(message);
24
- }),
25
- };
26
-
27
- // Use loggers.
28
- logger.verbatim.info('Hello, world!');
29
- logger.pretty.info('Hello, world!');
@@ -1,20 +0,0 @@
1
- import { Channel } from '@zimtsui/typelog';
2
- import * as Presets from '@zimtsui/typelog/presets';
3
- import { env, stderr } from 'node:process';
4
- import { formatWithOptions } from 'node:util';
5
-
6
- const envLevel = Presets.envlevels[env.NODE_ENV ?? ''] ?? Presets.Level.info;
7
-
8
- export const channel = Channel.create(
9
- Presets.Level,
10
- (message, level) => {
11
- if (level >= envLevel) console.error(
12
- Presets.prompt(
13
- formatWithOptions({ depth: null, colors: stderr.isTTY }, message),
14
- 'Default',
15
- level,
16
- stderr.isTTY,
17
- ),
18
- );
19
- },
20
- );
@@ -1,30 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "preserve",
5
- "moduleDetection": "force",
6
- "lib": ["esnext"],
7
- "sourceMap": true,
8
- "strict": true,
9
- "experimentalDecorators": true,
10
- "noUncheckedIndexedAccess": true,
11
- "noUncheckedSideEffectImports": true,
12
- "allowSyntheticDefaultImports": true,
13
- "rewriteRelativeImportExtensions": true,
14
- "allowJs": true,
15
- "noFallthroughCasesInSwitch": true,
16
- "noImplicitOverride": true,
17
- "resolveJsonModule": true,
18
- "verbatimModuleSyntax": true,
19
- "checkJs": true,
20
- "composite": true,
21
- "outDir": "../build",
22
- "skipLibCheck": true
23
- },
24
- "include": [
25
- "./**/*",
26
- ],
27
- "references": [
28
- { "path": "../src/tsconfig.json" }
29
- ]
30
- }