Skip to content

Commit

Permalink
Add 2.0.0 build files
Browse files Browse the repository at this point in the history
  • Loading branch information
hg-pyun committed Jun 28, 2019
1 parent 06a455f commit 5d5667b
Show file tree
Hide file tree
Showing 17 changed files with 424 additions and 2 deletions.
53 changes: 53 additions & 0 deletions lib/common/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ErrorLogConfig, GlobalLogConfig, RequestLogConfig, ResponseLogConfig } from './types';
declare function getGlobalConfig(): GlobalLogConfig;
declare function setGlobalConfig(config: GlobalLogConfig): void;
declare function mergeWithGlobalConfig(config?: RequestLogConfig | ResponseLogConfig | ErrorLogConfig): {
data?: boolean | undefined;
url?: boolean | undefined;
method?: boolean | undefined;
headers?: boolean | undefined;
status?: boolean | undefined;
statusText?: boolean | undefined;
code?: boolean | undefined;
usePrefix?: boolean | undefined;
prefixText?: string | undefined;
useDate?: boolean | undefined;
dateFormat?: string | undefined;
} | {
data?: boolean | undefined;
url?: boolean | undefined;
method?: boolean | undefined;
headers?: boolean | undefined;
usePrefix?: boolean | undefined;
prefixText?: string | undefined;
useDate?: boolean | undefined;
dateFormat?: string | undefined;
status?: boolean | undefined;
statusText?: boolean | undefined;
code?: boolean | undefined;
} | {
data?: boolean | undefined;
status?: boolean | undefined;
statusText?: boolean | undefined;
headers?: boolean | undefined;
usePrefix?: boolean | undefined;
prefixText?: string | undefined;
useDate?: boolean | undefined;
dateFormat?: string | undefined;
url?: boolean | undefined;
method?: boolean | undefined;
code?: boolean | undefined;
} | {
data?: boolean | undefined;
code?: boolean | undefined;
usePrefix?: boolean | undefined;
prefixText?: string | undefined;
useDate?: boolean | undefined;
dateFormat?: string | undefined;
url?: boolean | undefined;
method?: boolean | undefined;
headers?: boolean | undefined;
status?: boolean | undefined;
statusText?: boolean | undefined;
};
export { getGlobalConfig, setGlobalConfig, mergeWithGlobalConfig, };
50 changes: 50 additions & 0 deletions lib/common/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/common/print.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare function printLog(text: string): void;
export { printLog, };
11 changes: 11 additions & 0 deletions lib/common/print.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions lib/common/string-builder.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { GlobalLogConfig } from './types';
declare class StringBuilder {
private config;
private printQueue;
constructor(config: GlobalLogConfig);
makePrefix(logType: string): this;
makeDateFormat(): this;
makeUrl(url?: string): this;
makeMethod(method?: string): this;
makeData(data: object): this;
makeStatus(status?: number, statusText?: string): this;
build(): string;
}
export default StringBuilder;
74 changes: 74 additions & 0 deletions lib/common/string-builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions lib/common/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface CommonConfig {
usePrefix?: boolean;
prefixText?: string;
useDate?: boolean;
dateFormat?: string;
}
export interface GlobalLogConfig extends CommonConfig {
data?: boolean;
url?: boolean;
method?: boolean;
headers?: boolean;
status?: boolean;
statusText?: boolean;
code?: boolean;
}
export interface RequestLogConfig extends CommonConfig {
data?: boolean;
url?: boolean;
method?: boolean;
headers?: boolean;
}
export interface ResponseLogConfig extends CommonConfig {
data?: boolean;
status?: boolean;
statusText?: boolean;
headers?: boolean;
}
export interface ErrorLogConfig extends CommonConfig {
data?: boolean;
code?: boolean;
}
2 changes: 2 additions & 0 deletions lib/common/types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { setGlobalConfig } from './common/config';
import requestLogger from './logger/request';
import responseLogger from './logger/response';
import { errorLogger } from './logger/error';
export { setGlobalConfig, requestLogger, responseLogger, errorLogger };
42 changes: 42 additions & 0 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/logger/error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { AxiosError } from 'axios';
import { ErrorLogConfig } from '../common/types';
declare function errorLoggerWithoutPromise(error: AxiosError, config?: ErrorLogConfig): AxiosError;
declare function errorLogger(error: AxiosError): Promise<never>;
export { errorLogger, errorLoggerWithoutPromise };
49 changes: 49 additions & 0 deletions lib/logger/error.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/logger/request.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { AxiosRequestConfig } from 'axios';
import { RequestLogConfig } from '../common/types';
declare function requestLogger(request: AxiosRequestConfig, config?: RequestLogConfig): AxiosRequestConfig;
export default requestLogger;
Loading

0 comments on commit 5d5667b

Please sign in to comment.