Skip to content

Commit

Permalink
Merge pull request #18 from hg-pyun/develop/2.0.0
Browse files Browse the repository at this point in the history
Develop/2.0.0
  • Loading branch information
hg-pyun authored Jun 28, 2019
2 parents 71feacd + 5d5667b commit ed7d191
Show file tree
Hide file tree
Showing 44 changed files with 8,588 additions and 199 deletions.
17 changes: 17 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/typescript"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global
* @phg2491
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea
/node_modules/
/test/
/.eslintrc.json
/.gitignore
/tsconfig.json
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"trailingComma": "es5",
"singleQuote": true,
"arrowParens": "always",
"tabWidth": 4
}
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 };
Loading

0 comments on commit ed7d191

Please sign in to comment.