File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 1+ import { LoggerOptions } from './logger_options.ts' ;
2+ import { StdOutFunctionType } from './std_out_function_type.ts' ;
3+
14export default class Logger {
2- constructor ( ) {
3-
5+ private _stdout : StdOutFunctionType ;
6+ private _options ? : LoggerOptions ;
7+ constructor (
8+ stdout : StdOutFunctionType ,
9+ options ? : LoggerOptions
10+ ) {
11+ this . _stdout = stdout ;
12+ this . _options = options ;
13+ }
14+
15+ /**
16+ * This getter returns the passed in standard output function.
17+ */
18+ get stdout ( ) : StdOutFunctionType {
19+ return this . _stdout ;
20+ }
21+
22+ /**
23+ * This getter returns the passed in options for the logger.
24+ */
25+ get options ( ) : LoggerOptions | undefined {
26+ return this . _options ;
427 }
528}
Original file line number Diff line number Diff line change 1+ /**
2+ * This interface describes all options available for the logger.
3+ */
4+ export interface LoggerOptions {
5+ /** Enables colors */
6+ color ? : boolean ,
7+ /** Adds a timestamp to the log message */
8+ addTimestamp ? : boolean
9+ }
Original file line number Diff line number Diff line change 1+ import { StdOutFunctionType } from './std_out_function_type.ts' ;
2+
3+ export type {
4+ StdOutFunctionType
5+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * This type describes the default function interface for the logger standard output.
3+ * @param data The data to log
4+ */
5+ export type StdOutFunctionType = ( data : string ) => void ;
You can’t perform that action at this time.
0 commit comments