Skip to content

Commit

Permalink
refactor: use individual named exports of reporters
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Apr 11, 2023
1 parent 5a4708d commit 57bb579
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/index.browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BrowserReporter from "./reporters/browser";
import { BrowserReporter } from "./reporters/browser";
import { createConsola as _createConsola } from "./consola";
import type { ConsolaOptions } from "./types";

Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { isDebug, isTest, isCI } from "std-env";
import { LogLevels, LogLevel } from "./constants";
import type { ConsolaOptions } from "./types";
import { BasicReporter, FancyReporter } from "./reporters";
import { BasicReporter } from "./reporters/basic";
import { FancyReporter } from "./reporters/fancy";
import { ConsolaInstance, createConsola as _createConsola } from "./consola";

export * from "./index.shared";
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { writeStream } from "../utils/stream";

const bracket = (x: string) => (x ? `[${x}]` : "");

export default class BasicReporter implements ConsolaReporter {
export class BasicReporter implements ConsolaReporter {
formatStack(stack: string, opts: FormatOptions) {
return " " + parseStack(stack).join("\n ");
}
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LogObject } from "../types";

export default class BrowserReporter {
export class BrowserReporter {
options: any;
defaultColor: string;
levelColorMap: Record<number, string>;
Expand Down
4 changes: 2 additions & 2 deletions src/reporters/fancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as colors from "colorette";
import { parseStack } from "../utils/error";
import { FormatOptions, LogObject } from "../types";
import { LogLevel, LogType } from "../constants";
import BasicReporter from "./basic";
import { BasicReporter } from "./basic";

export const TYPE_COLOR_MAP: { [k in LogType]?: string } = {
info: "cyan",
Expand Down Expand Up @@ -35,7 +35,7 @@ const TYPE_ICONS: { [k in LogType]?: string } = {
log: "",
};

export default class FancyReporter extends BasicReporter {
export class FancyReporter extends BasicReporter {
formatStack(stack: string) {
return (
"\n" +
Expand Down
3 changes: 0 additions & 3 deletions src/reporters/index.ts

This file was deleted.

0 comments on commit 57bb579

Please sign in to comment.