-
-
-
-
-
-
-
-
-
-
-
+
+
-
+[![npm downloads](https://img.shields.io/npm/dw/diary?colorA=f6f8fa&colorB=f6f8fa&style=flat&label=npm%20downloads)](https://npm-stat.com/charts.html?package=diary)
+[![size](https://img.shields.io/bundlephobia/minzip/diary?colorA=f6f8fa&colorB=f6f8fa&style=flat)](https://bundlephobia.com/package/diary)
+[![licenses](https://licenses.dev/b/npm/diary?style=light)](https://licenses.dev/npm/diary)
+
This is free to use software, but if you do like it, consisder supporting me ❤️
-[![sponsor me](https://badgen.net/badge/icon/sponsor?icon=github&label&color=gray)](https://github.com/sponsors/maraisr)
-[![buy me a coffee](https://badgen.net/badge/icon/buymeacoffee?icon=buymeacoffee&label&color=gray)](https://www.buymeacoffee.com/marais)
+[![sponsor me](https://img.shields.io/badge/sponsor-f6f8fa?style=flat&logo=github&logoColor=21262d)](https://github.com/sponsors/maraisr)
+[![buy me a coffee](https://img.shields.io/badge/buy_me_a_coffee-f6f8fa?style=flat&logo=buymeacoffee&logoColor=21262d)](https://www.buymeacoffee.com/marais)
-## ⚡ Features
-
-- No [dependencies](https://npm.anvaka.com/#/view/2d/diary)
-- Outstanding [performance](#-benchmark)
-- Support for [`debug`'s filter](https://www.npmjs.com/package/debug#wildcards)
-
## ⚙️ Install
-```sh
+```shell
npm add diary
```
+_Avaliable on [jsr](https://jsr.io/@mr/log), [NPM](https://npmjs.com/package/diary) and
+[deno.land](https://deno.land/x/diary)_
+
## 🚀 Usage
```ts
-import { info, diary, enable } from 'diary';
+import { diary } from 'diary';
+import { pretty } from 'diary/output.console';
-// 1️⃣ Choose to enable the emission of logs, or not.
-enable('*');
+// 1️⃣ create a diary
+let log = diary(pretty);
// 2️⃣ log something
-info('this important thing happened');
-// ~> ℹ info this important thing happened
-
-// Maybe setup a scoped logger
-const scopedDiary = diary('my-module', (event) => {
- if (event.level === 'error') {
- Sentry.captureException(event.error);
- }
-});
-
-// 3️⃣ log more things
-scopedDiary.info('this other important thing happened');
-// ~> ℹ info [my-module] this other important thing happened
-```
+log('info', '{name} is now {type}', { name: 'marais', type: 'admin' });
+// ~> ℹ info marais is now admin
-Node users
-
-The `enable` function is executed for you from the `DEBUG` environment variable. And as a drop in replacement for
-`debug`.
-
-```shell
-DEBUG=client:db,server:* node example.js
+// 💡 log message as completely typesafe
+log('debug', '{name} was created {at}', { name: 'marais' });
+// ^? Error: 'at' is not defined
```
-## 🔎 API
-
-### diary(name: string, onEmit?: Reporter)
-
-Returns: [log functions](#log-functions)
-
-> A default diary is exported, accessible through simply importing any [log function](#log-functions).
->
->
-> Example of default diary
->
-> ```ts
-> import { info } from 'diary';
->
-> info("i'll be logged under the default diary");
-> ```
->
->
+:construction: Talk about structured logging
-#### name
+:construction: Talk about fragments vs sentences
-Type: `string`
+:construction: Talk about onEmit
-The name given to this _diary_—and will also be available in all logEvents.
+:construction: Show /using and /stream
-#### onEmit (optional)
+:construction: Complete examples
-Type: `Reporter`
-
-A reporter is run on every log message (provided its [enabled](#enablequery-string)). A reporter gets given the
-`LogEvent` interface:
-
-```ts
-interface LogEvent {
- name: string;
- level: LogLevels;
-
- messages: any[];
-}
-```
-
-> _Note_: you can attach any other context in middleware.
->
-> Example
->
-> ```ts
-> import { diary, default_reporter } from 'diary';
-> const scope = diary('scope', (event) => {
-> event.ts = new Date();
-> return default_reporter(event);
-> });
-> ```
->
->
-
-Errors (for `error` and `fatal`) there is also an `error: Error` property.
-
-### _log functions_
-
-A set of functions that map to `console.error`, `console.warn`, `console.debug`, `console.info` and `console.info`.
-Aptly named;
-
-`fatal`, `error`, `warn`, `debug`, `info`, and `log`. All of which follow the same api signature:
-
-```ts
-declare logFunction(message: object | Error | string, ...args: unknown[]): void;
-```
-
-All parameters are simply spread onto the function and reported. Node/browser's built-in formatters will format any
-objects (by default).
-
-```ts
-info('hi there'); // ℹ info hi there
-info('hi %s', 'there'); // ℹ info hi there
-info('hi %j', { foo: 'bar' }); // ℹ info hi { "foo": "bar" }
-info('hi %o', { foo: 'bar' }); // ℹ info hi { foo: 'bar' }
-info({ foo: 'bar' }); // ℹ info { foo: 'bar' }
-```
-
-#### diary (optional)
-
-Type: `Diary`
-
-The result of a calling [diary](#diary-name-string);
-
-### enable(query: string)
-
-Type: `Function`
-
-Opts certain log messages into being output. See more [here](#programmatic).
+:construction: What does production look like?
## 💨 Benchmark
@@ -195,14 +85,9 @@ AOT
✔ debug ~ 1,287,846 ops/sec ± 0.24%
```
-> AOT: The logger is setup a head of time, and ops/sec is the result of calling the log fn. Simulates long running
-> process, with a single logger. JIT: The logger is setup right before the log fn is called per op. Simulates setting up
-> a logger per request for example.
-
-## Related
-
-- [workers-logger](https://github.com/maraisr/workers-logger) — fast and effective logging for
- [Cloudflare Workers](https://workers.cloudflare.com/)
+> AOT: The logger is setup a head of time, and ops/sec is the result of calling the log fn.
+> Simulates long running process, with a single logger. JIT: The logger is setup right before the
+> log fn is called per op. Simulates setting up a logger per request for example.
## License
diff --git a/scripts/build.ts b/scripts/build.ts
new file mode 100644
index 0000000..83392cb
--- /dev/null
+++ b/scripts/build.ts
@@ -0,0 +1,83 @@
+import { build, emptyDir } from '@deno/dnt';
+
+await emptyDir('./npm');
+
+await build({
+ entryPoints: [
+ './lib/mod.ts',
+ {
+ name: './stream',
+ path: './lib/stream.ts',
+ },
+ {
+ name: './using',
+ path: './lib/using.ts',
+ },
+ {
+ name: './output.console',
+ path: './lib/output.console.ts',
+ },
+ {
+ name: './utils',
+ path: './lib/utils.ts',
+ },
+ ],
+ outDir: './npm',
+ shims: {
+ deno: 'dev',
+ },
+
+ esModule: true,
+ scriptModule: 'cjs',
+
+ declaration: 'inline',
+ declarationMap: false,
+
+ typeCheck: 'both',
+ skipSourceOutput: true,
+ test: true,
+
+ importMap: 'deno.json',
+
+ package: {
+ name: 'diary',
+ version: Deno.args[0],
+ description: 'Fast effective logging library for just about everything.',
+ repository: 'maraisr/diary',
+ license: 'MIT',
+ author: {
+ name: 'Marais Rososuw',
+ email: 'me@marais.dev',
+ url: 'https://marais.io',
+ },
+ sideEffects: false,
+ keywords: [
+ 'fast',
+ 'logging',
+ 'utility',
+ 'middleware',
+ 'debug',
+ 'logger',
+ ],
+ },
+
+ compilerOptions: {
+ target: 'ES2022',
+ lib: ['ES2022', 'WebWorker'],
+ },
+
+ filterDiagnostic(diag) {
+ let txt = diag.messageText.toString();
+ // ignore type error for missing Deno built-in information
+
+ return (
+ !/Type 'ReadableStream<.*>' must have a/.test(txt) &&
+ !txt.includes(`Type 'Timeout' is not assignable to type 'number'.`)
+ );
+ },
+
+ async postBuild() {
+ await Deno.copyFile('license', 'npm/license');
+ await Deno.copyFile('readme.md', 'npm/readme.md');
+ },
+});
diff --git a/shots/logo.png b/shots/logo.png
deleted file mode 100644
index 871f509..0000000
Binary files a/shots/logo.png and /dev/null differ
diff --git a/src/generic.ts b/src/generic.ts
deleted file mode 100644
index cc01646..0000000
--- a/src/generic.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-///
-
-import { diary as _diary, type LogEvent, type Reporter, type Diary } from './logger';
-
-function reporter(event: LogEvent) {
- let label = '';
- const fn = console[event.level === 'fatal' ? 'error' : event.level];
-
- if (event.name) label += `[${event.name}] `;
-
- if (typeof event.messages[0] === 'object') {
- return void fn(label, ...event.messages);
- } else {
- const message = event.messages.shift();
- return void fn(label + message, ...event.messages);
- }
-}
-
-export const diary = (name: string, onEmit: Reporter = reporter): Diary => _diary(name, onEmit);
-
-const { fatal, error, warn, debug, info, log } = diary('', reporter);
-export { fatal, error, warn, debug, info, log };
-export type { Diary, LogEvent, LogLevels, Reporter } from './logger';
-export { enable } from './logger';
\ No newline at end of file
diff --git a/src/index.test.ts b/src/index.test.ts
deleted file mode 100644
index df400aa..0000000
--- a/src/index.test.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import {suite, test} from 'uvu';
-import * as assert from 'uvu/assert';
-import { restoreAll, spy, spyOn } from 'nanospy';
-
-import * as diary from './logger'
-import type {Reporter} from './logger'
-
-import * as GENERIC from './generic';
-import * as NODE from './node';
-
-const levels = ['fatal', 'error', 'warn', 'debug', 'info', 'log'] as const;
-
-function before() {
- diary.enable('*');
- restoreAll();
-}
-
-test.before.each(before);
-
-Object.entries({ generic: GENERIC, node: NODE }).forEach(([name, mod]) => {
- const s = suite(`mod :: ${name}`);
- s.before.each(before);
-
- s('exports', () => {
- [...levels, 'diary'].forEach((verb) => {
- assert.type(
- // @ts-ignore
- mod[verb],
- 'function',
- `Expected diary to have #${verb} function`,
- );
- });
- });
-
- s.run();
-});
-
-test('should allow object logging', () => {
- const reporter = spy();
- const scope = diary.diary('error', reporter);
-
- scope.info('info');
- assert.equal(reporter.callCount, 1);
- assert.equal(reporter.calls[0][0], 'ℹ info info');
- scope.info({ foo: 'bar' });
-
- assert.equal(reporter.calls[1][0], "ℹ info { foo: 'bar' }");
-});
-
-const allows = suite('allows');
-allows.before.each(before);
-
-allows('should only allow some scopes', () => {
- const reporter = spy();
- const scopeA = diary.diary('scope:a', reporter);
- const scopeB = diary.diary('scope:b', reporter);
-
- diary.enable('scope:a');
-
- scopeA.info('info a');
- scopeB.info('info b');
- scopeB.info('info b');
- scopeA.info('info a');
-
- assert.equal(
- reporter.calls.flatMap((i) => i[0].messages),
- ['info a', 'info a'],
- );
-});
-
-allows('should allow nested scopes', () => {
- const reporter = spy();
- const scopeA = diary.diary('scope:a', reporter);
- const scopeB = diary.diary('scope:b', reporter);
-
- diary.enable('scope:*');
-
- scopeA.info('info a');
- scopeB.info('info b');
-
- assert.equal(
- reporter.calls.flatMap((i) => i[0].messages),
- ['info a', 'info b'],
- );
-});
-
-allows('should allow multiple allows per enable', () => {
- const reporter = spy();
-
- const scopeA = diary.diary('scope:a', reporter);
- const scopeB = diary.diary('scope:b', reporter);
-
- diary.enable('scope:a,blah');
-
- scopeA.info('info a');
- scopeB.info('info b');
-
- diary.enable('blah,scope:a');
-
- scopeA.info('info a');
- scopeB.info('info b');
- scopeB.info('info b');
- scopeA.info('info a');
-
- diary.enable('foo,bar:*,scope:,scope:*');
-
- scopeA.info('info a');
- scopeB.info('info b');
-
- assert.equal(
- reporter.calls.flatMap((i) => i[0].messages),
- ['info a', 'info a', 'info a', 'info a', 'info b'],
- );
-});
-
-allows.run();
-
-levels.forEach((level) => {
- const l = suite(`level :: ${level}`);
- l.before.each(before);
-
- l('should log something', () => {
- const reporter = spy();
- const scope = diary.diary(level, reporter);
-
- scope[level]('something');
- scope[level]('something else');
- scope[level]('object else', { foo: 'bar' });
- scope[level]({ foo: 'bar' });
-
- assert.equal(reporter.callCount, 4);
-
- assert.equal(
- reporter.calls.map((i) => i[0]),
- [
- {
- name: level,
- level: level,
- messages: ['something'],
- },
- {
- name: level,
- level: level,
- messages: ['something else'],
- },
- {
- name: level,
- level: level,
- messages: ['object else', { foo: 'bar' }],
- },
- {
- name: level,
- level: level,
- messages: [{ foo: 'bar' }],
- },
- ],
- );
- });
-
- l.run();
-});
diff --git a/src/json.test.ts b/src/json.test.ts
deleted file mode 100644
index d71503d..0000000
--- a/src/json.test.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import {test, suite} from 'uvu';
-import * as assert from 'uvu/assert';
-import * as diary from './logger';
-import * as json from './json';
-import { restoreAll, spyOn } from 'nanospy';
-
-test('api', () => {
- assert.type(json.reporter, 'function');
-});
-
-const output = suite('output');
-
-output.before.each(() => {
- diary.enable('*');
- restoreAll();
-});
-
-output('simple', () => {
- const log_output = spyOn(console, 'log', () => {});
-
- const scope = diary.diary('json', json.reporter);
- scope.info('foo %s', 'bar');
-
- assert.equal(log_output.callCount, 1);
- assert.equal(
- log_output.calls[0][0],
- '{"name":"json","level":"info","message":"foo bar"}',
- );
-});
-
-output('with rest', () => {
- const log_output = spyOn(console, 'log', () => {});
-
- const scope = diary.diary('json', (event) => {
- event.context = { sequence: 0 };
- json.reporter(event);
- });
-
- scope.info('foo %s', 'bar');
-
- assert.equal(log_output.callCount, 1);
- assert.equal(
- log_output.calls[0][0],
- '{"name":"json","level":"info","message":"foo bar","context":{"sequence":0}}',
- );
-});
-
-output.run();
diff --git a/src/json.ts b/src/json.ts
deleted file mode 100644
index f45c248..0000000
--- a/src/json.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { Reporter } from './logger';
-import { sprintf } from './utils';
-
-export const reporter: Reporter = ({ name, level, messages, ...rest }) => {
- if (typeof messages[0] === 'object') {
- return console.log(
- JSON.stringify({
- name,
- level,
- ...messages,
- ...rest,
- })
- );
- } else {
- const message = messages.shift() as string;
- return console.log(
- JSON.stringify({
- name,
- level,
- message: sprintf(message, ...messages),
- ...rest,
- })
- );
- }
-};
diff --git a/src/levels.ts b/src/levels.ts
deleted file mode 100644
index 07fa6e3..0000000
--- a/src/levels.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export const fatal = '✗ fatal' as const;
-export const error = '✗ error' as const;
-export const warn = '‼ warn ' as const;
-export const debug = '● debug' as const;
-export const info = 'ℹ info ' as const;
-export const log = '◆ log ' as const;
diff --git a/src/logger.ts b/src/logger.ts
deleted file mode 100644
index 27a2fcc..0000000
--- a/src/logger.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-export type Reporter = (event: LogEvent) => void;
-
-interface LogFn {
- (message: T, ...args: unknown[]): void;
- (message: T, ...args: unknown[]): void;
- (message: unknown, ...args: unknown[]): void;
- (message: string, ...args: unknown[]): void;
-}
-
-export type LogLevels = 'fatal' | 'error' | 'warn' | 'debug' | 'info' | 'log';
-
-export interface LogEvent {
- name: string;
- level: LogLevels;
-
- messages: unknown[];
-
- [other: string]: any;
-}
-
-let allows: RegExp[] = [];
-
-const to_reg_exp = (x: string) => new RegExp(x.replace(/\*/g, '.*') + '$');
-
-/**
- * Configure what logs to emit. Follows the colon delimited scheme.
- *
- * @example
- * ```ts
- * import { diary, enable } from 'diary';
- *
- * enable('scope:A');
- *
- * const scopeA = diary('scope:A');
- * const scopeB = diary('scope:B');
- *
- * scopeA.log('foo bar'); // => 'foo bar'
- * scopeB.log('foo bar'); // => na
- *
- * enable('scope:*');
- *
- * scopeA.log('foo bar'); // => 'foo bar'
- * scopeB.log('foo bar'); // => 'foo bar'
- * ```
- */
-export const enable = (allows_query: string) => {
- allows = allows_query.split(/[\s,]+/).map(to_reg_exp);
-};
-
-const logger = (
- name: string,
- reporter: Reporter,
- level: LogLevels,
- ...messages: unknown[]
-): void => {
- for (let len = allows.length; len--;)
- if (allows[len].test(name)) return reporter({ name, level, messages });
-};
-
-export type Diary = Record;
-
-/**
- * Creates a new diary logging instance.
- *
- * @example
- * ```ts
- * import { diary } from 'diary';
- *
- * const log = diary('my-fancy-app');
- *
- * log.info('app has started');
- * ```
- *
- * @param name A name to give this diary instance this can be unique to your application, or not.
- * When logged, it'll exist after the level string, eg: `ℹ info [my-fancy-app] app has started`
- * @param onEmit The reporter that handles the output of the log messages
- */
-export const diary = (name: string, onEmit?: Reporter): Diary => {
- return {
- fatal: logger.bind(0, name, onEmit, 'fatal'),
- error: logger.bind(0, name, onEmit, 'error'),
- warn: logger.bind(0, name, onEmit, 'warn'),
- debug: logger.bind(0, name, onEmit, 'debug'),
- info: logger.bind(0, name, onEmit, 'info'),
- log: logger.bind(0, name, onEmit, 'log'),
- };
-};
\ No newline at end of file
diff --git a/src/node.ts b/src/node.ts
deleted file mode 100644
index 0c79ada..0000000
--- a/src/node.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-///
-
-import { format } from 'node:util'
-
-import { enable, diary as _diary, type LogEvent, type Diary, Reporter } from './logger';
-import * as LEVELS from './levels';
-
-enable(process.env.DEBUG || 'a^');
-
-function reporter(event: LogEvent) {
- let label = `${LEVELS[event.level]} `;
- const fn = console[event.level === 'fatal' ? 'error' : event.level];
-
- if (event.name) label += `[${event.name}] `;
-
- let message: string;
- const maybe_error = event.messages[0];
-
- if (
- maybe_error instanceof Error &&
- typeof maybe_error.stack !== 'undefined'
- ) {
- const m = maybe_error.stack.split('\n');
- m.shift();
- message = `${maybe_error.message}\n${m.join('\n')}`;
- } else {
- message = format(...event.messages);
- }
-
- return void fn(label + message);
-}
-
-export const diary = (name: string, onEmit: Reporter = reporter): Diary => _diary(name, onEmit);
-
-const { fatal, error, warn, debug, info, log } = diary('', reporter);
-export { fatal, error, warn, debug, info, log };
-export type { Diary, LogEvent, LogLevels, Reporter } from './logger';
-export { enable } from './logger';
diff --git a/src/utils.test.ts b/src/utils.test.ts
deleted file mode 100644
index a99e6c9..0000000
--- a/src/utils.test.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { suite } from 'uvu';
-import * as assert from 'uvu/assert';
-import * as lib from './utils';
-
-const sprintf = suite('sprintf');
-
-sprintf('should format something basic', () => {
- assert.equal(lib.sprintf('hello %s', 'world'), 'hello world');
-});
-
-sprintf('should support strings', () => {
- assert.equal(lib.sprintf('foo %s', { bar: 'baz' }), 'foo [object Object]');
- assert.equal(lib.sprintf('foo %s', ['bar']), 'foo bar');
- assert.equal(lib.sprintf('foo %s', ['bar', 'baz']), 'foo bar,baz');
-});
-
-sprintf('should support object notation', () => {
- assert.equal(lib.sprintf('foo %o', { bar: 'baz' }), 'foo {"bar":"baz"}');
- assert.equal(lib.sprintf('foo %O', { bar: 'baz' }), 'foo {"bar":"baz"}');
- assert.equal(lib.sprintf('foo %o', 'bar'), 'foo bar');
- assert.equal(lib.sprintf('foo %o', ['bar', 'baz']), 'foo ["bar","baz"]');
-});
-
-sprintf('should support integers', () => {
- assert.equal(lib.sprintf('foo %i', 1), 'foo 1');
- assert.equal(lib.sprintf('foo %i', 1.25), 'foo 1');
- assert.equal(lib.sprintf('foo %d', 1.25), 'foo 1');
-});
-
-sprintf('should support floats', () => {
- assert.equal(lib.sprintf('foo %f', 1), 'foo 1');
- assert.equal(lib.sprintf('foo %f', 1.25), 'foo 1.25');
- assert.equal(lib.sprintf('foo %f', 1.25), 'foo 1.25');
-});
-
-sprintf('should work when under supplied', () => {
- assert.equal(lib.sprintf('foo %s %s', 'bar'), 'foo bar undefined');
- assert.equal(
- lib.sprintf('foo %s with %o', 'bar', { bar: 'baz' }),
- 'foo bar with {"bar":"baz"}',
- );
- // assert.equal(lib.sprintf('foo %s with %o', 'bar', {"bar":"baz"}, 'test'), 'foo bar with {"bar":"baz"} test');
- assert.equal(
- lib.sprintf('foo %o %s', { bar: 'baz' }),
- 'foo {"bar":"baz"} undefined',
- );
-});
-
-sprintf('should work, when over supplied', () => {
- assert.equal(lib.sprintf('foo %s', 'bar', 'baz'), 'foo bar');
-});
-
-const compare = suite('compare');
-
-compare('should compare when equal', () => {
- assert.equal(lib.compare('log', 'log'), 0);
- assert.equal(lib.compare('error', 'error'), 0);
-});
-
-compare('should compare when less', () => {
- assert.equal(lib.compare('error', 'fatal'), -1);
- assert.equal(lib.compare('warn', 'error'), -1);
-});
-
-compare('should compare when more', () => {
- assert.equal(lib.compare('fatal', 'error'), 1);
- assert.equal(lib.compare('info', 'log'), 1);
-});
-
-compare('show be zero when level is _real_', () => {
- // @ts-ignore
- assert.equal(lib.compare('what the', 'log'), 0);
- // @ts-ignore
- assert.equal(lib.compare('what the', 'heck'), 0);
- // @ts-ignore
- assert.equal(lib.compare('log', 'heck'), 0);
-});
-
-sprintf.run();
-compare.run();
diff --git a/src/utils.ts b/src/utils.ts
deleted file mode 100644
index 92bbd22..0000000
--- a/src/utils.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { LogLevels } from './logger';
-
-export const sprintf = (message: string, ...extra: unknown[]) =>
- message.replace(/(\s+)(%[Oodifs](?=[^a-z0-9A-Z]|$))/g, (_, ws, pattern) => {
- let v = extra.shift() as string | undefined;
-
- if (/[Oo]/.test(pattern) && typeof v === 'object') v = JSON.stringify(v);
- else if (/[di]/.test(pattern) && v) v = v.toString().replace(/\..*$/, '');
-
- return ws + v;
- });
-
-const LEVELS: Record = { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, log: 10 } as const;
-
-/**
- * Returns if a log level is than its comparitor.
- *
- * @example
- *
- * ```js
- * compare("error", "fatal") === -1;
- * // Thus error is "less-than" fatal.
- * ```
- *
- * @param input the level youre trying to test
- * @param target the level youre wanting to compare too
- */
-export const compare = (log_level: LogLevels, input: LogLevels) => {
- if (!(input in LEVELS) || !(log_level in LEVELS)) return 0;
-
- return LEVELS[input] === LEVELS[log_level]
- ? 0
- : LEVELS[input] < LEVELS[log_level]
- ? 1
- : -1;
-};
diff --git a/tsconfig.json b/tsconfig.json
deleted file mode 100644
index b35b655..0000000
--- a/tsconfig.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "extends": "@marais/tsconfig",
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "diary": ["src/index.d.ts"],
- "diary/*": ["src/*.d.ts"]
- }
- },
- "include": ["src", "test"],
- "exclude": ["node_modules"]
-}