Skip to content

Commit

Permalink
Change logger to log option
Browse files Browse the repository at this point in the history
  • Loading branch information
falsandtru committed Feb 13, 2024
1 parent 9c7d643 commit d77b5ae
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.44.0

- Change `logger` to `log` option.
- Remove `cache` option.

## 3.43.0
Expand Down
4 changes: 2 additions & 2 deletions gh-pages/docs/apis/pjax/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ The next internal defaults are also applied.

Reload targets of scripts.

### logger: string = `''`
### log: string = `''`

Logging targets of scripts.
Log targets of scripts.

## fallback: (target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown) => void = ...

Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface Config {
readonly script?: boolean;
readonly ignore?: string;
readonly reload?: string;
readonly logger?: string;
readonly log?: string;
};
readonly fallback?: (target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown) => void;
readonly sequence?: Sequence<any, any, any, any>;
Expand Down
2 changes: 1 addition & 1 deletion src/layer/domain/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Config implements Options {
security: '[src*=".scr.kaspersky-labs.com/"]',
},
reload: '',
logger: '',
log: '',
};
public fallback(target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown): void {
if (target instanceof HTMLAnchorElement ||
Expand Down
18 changes: 9 additions & 9 deletions src/layer/domain/router/module/update/script.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: ''
log: ''
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>())
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
cancellation,
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
new Cancellation<Error>(),
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('Unit: layer/domain/router/module/update/script', () => {
{
ignore: '',
reload: '',
logger: 'head'
log: 'head'
},
1e3,
cancellation,
Expand Down
8 changes: 4 additions & 4 deletions src/layer/domain/router/module/update/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function script(
selector: {
ignore: string;
reload: string;
logger: string;
log: string;
},
timeout: number,
cancellation: Cancellee<Error>,
Expand Down Expand Up @@ -79,7 +79,7 @@ export function script(
results
.bind(cancellation.either)
.bind(([sp, ap]) =>
io.evaluate(script, code, selector.logger, skip, AtomicPromise.all(sp), cancellation)
io.evaluate(script, code, selector.log, skip, AtomicPromise.all(sp), cancellation)
.extract(
p => Right(tuple(push(sp, [p]), ap)),
p => Right(tuple(sp, push(ap, [p]))))),
Expand Down Expand Up @@ -123,7 +123,7 @@ export { fetch as _fetch }
function evaluate(
script: HTMLScriptElement,
code: string,
logger: string,
log: string,
skip: ReadonlySet<URL.Href<StandardURL>>,
wait: Promise<any>,
cancellation: Cancellee<Error>,
Expand All @@ -134,7 +134,7 @@ function evaluate(
script = script.ownerDocument === document
? script // only for testing
: document.importNode(script.cloneNode(true), true) as HTMLScriptElement;
const logging = !!script.parentElement && script.parentElement.matches(logger.trim() || '_');
const logging = !!script.parentElement && script.parentElement.matches(log.trim() || '_');
const container = document.querySelector(
logging
? script.parentElement!.id
Expand Down

0 comments on commit d77b5ae

Please sign in to comment.