Skip to content

Commit f426131

Browse files
committed
fix: ignore print model
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
1 parent e90bed2 commit f426131

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/coreEnforcer.ts

-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export class CoreEnforcer {
149149
this.model.clearPolicy();
150150
await this.adapter.loadPolicy(this.model);
151151

152-
this.model.printPolicy();
153152
if (this.autoBuildRoleLinks) {
154153
await this.buildRoleLinksInternal();
155154
}
@@ -169,7 +168,6 @@ export class CoreEnforcer {
169168
throw new Error('filtered policies are not supported by this adapter');
170169
}
171170

172-
this.model.printPolicy();
173171
if (this.autoBuildRoleLinks) {
174172
await this.buildRoleLinksInternal();
175173
}

src/model/model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as rbac from '../rbac';
1616
import * as util from '../util';
1717
import { Config, ConfigInterface } from '../config';
1818
import { Assertion } from './assertion';
19-
import { logPrint } from '../log';
19+
import { getLogger, logPrint } from '../log';
2020

2121
export const sectionNameMap: { [index: string]: string } = {
2222
r: 'request_definition',
@@ -379,6 +379,9 @@ export class Model {
379379

380380
// printPolicy prints the policy to log.
381381
public printPolicy(): void {
382+
if (!getLogger().isEnable()) {
383+
return;
384+
}
382385
logPrint('Policy:');
383386
this.model.forEach((map, key) => {
384387
if (key === 'p' || key === 'g') {

0 commit comments

Comments
 (0)