Skip to content

Commit

Permalink
Merge pull request #1 from gitcoindev/feat-npm-module
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Dec 9, 2023
2 parents 7945e98 + 3d7111b commit 4ef4a59
Show file tree
Hide file tree
Showing 19 changed files with 7,814 additions and 6,014 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ node_modules
.pnp.cjs
.pnp.loader.mjs
static/dist
.env
.env
# vscode
.vscode
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# `@ubiquity/ts-template`
# `@ubiquity-logger`

This template repository includes support for the following:

- TypeScript
- Environment Variables
- Conventional Commits
- Automatic publishing of pull requests to Cloudflare Pages
Ubiquity logger NPM module.
33 changes: 0 additions & 33 deletions build/esbuild-build.ts

This file was deleted.

18 changes: 0 additions & 18 deletions build/esbuild-server.ts

This file was deleted.

4 changes: 0 additions & 4 deletions build/index.ts

This file was deleted.

53 changes: 53 additions & 0 deletions dist/logs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { SupabaseClient } from "@supabase/supabase-js";
import { Context } from "probot";
import { LogLevel, PrettyLogs } from "./pretty-logs.js";

declare class LogReturn {
logMessage: LogMessage;
metadata?: any;
constructor(logMessage: LogMessage, metadata?: any);
}
type FunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
}[keyof T];
type PublicMethods<T> = Exclude<FunctionPropertyNames<T>, "constructor" | keyof object>;
type LogMessage = {
raw: string;
diff: string;
level: LogLevel;
type: PublicMethods<Logs>;
};
declare class Logs {
private _supabase;
private _context;
private _maxLevel;
private _queue;
private _concurrency;
private _retryDelay;
private _throttleCount;
private _retryLimit;
static console: PrettyLogs;
private _log;
private _addDiagnosticInformation;
ok(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
info(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
error(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
debug(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
fatal(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
verbose(log: string, metadata?: any, postComment?: boolean): LogReturn | null;
constructor(supabase: SupabaseClient, retryLimit: number, logLevel: LogLevel, context: Context | null);
private _sendLogsToSupabase;
private _processLogs;
private _retryLog;
private _processLogQueue;
private _throttle;
private _addToQueue;
private _save;
static _commentMetaData(metadata: any, level: LogLevel): string;
private _diffColorCommentMessage;
private _postComment;
private _getNumericLevel;
static convertErrorsIntoObjects(obj: any): any;
}

export { type LogMessage, LogReturn, Logs };
Loading

0 comments on commit 4ef4a59

Please sign in to comment.