-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
- Loading branch information
There are no files selected for viewing
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, }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare function printLog(text: string): void; | ||
export { printLog, }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; |