当前位置: 首页>>代码示例>>Java>>正文


Java Level类代码示例

本文整理汇总了Java中org.slf4j.event.Level的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Level类属于org.slf4j.event包,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkRole

import org.slf4j.event.Level; //导入依赖的package包/类
private boolean checkRole(Authentication authentication, Object privilege, boolean logPermission) {
    String roleKey = getRoleKey(authentication);

    if (RoleConstant.SUPER_ADMIN.equals(roleKey)) {
        log(logPermission, Level.INFO,
            "access granted: privilege={}, role=SUPER-ADMIN, userKey={}",
            privilege, getUserKey());
        return true;
    }

    if (!roleService.getRoles(TenantContextUtils.getRequiredTenantKeyValue(tenantContextHolder.getContext()))
        .containsKey(roleKey)) {
        log(logPermission, Level.ERROR,
            "access denied: privilege={}, role={}, userKey={} due to role is missing",
            privilege, roleKey, getUserKey());
        throw new AccessDeniedException("Access is denied");
    }

    return false;
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:21,代码来源:PermissionCheckService.java

示例2: handleRequestPost

import org.slf4j.event.Level; //导入依赖的package包/类
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Timed
public Response handleRequestPost(SamlRequestDto samlRequestDto) {

    relayStateValidator.validate(samlRequestDto.getRelayState());

    AuthnRequest authnRequest = stringSamlAuthnRequestTransformer.apply(samlRequestDto.getSamlRequest());

    SamlValidationResponse signatureValidationResponse = authnRequestSignatureValidator.validate(authnRequest, SPSSODescriptor.DEFAULT_ELEMENT_NAME);

    protectiveMonitoringLogger.logAuthnRequest(authnRequest, Direction.INBOUND, signatureValidationResponse.isOK());

    if (!signatureValidationResponse.isOK()) {
        SamlValidationSpecificationFailure failure = signatureValidationResponse.getSamlValidationSpecificationFailure();
        throw new SamlTransformationErrorException(failure.getErrorMessage(), signatureValidationResponse.getCause(), Level.ERROR);
    }

    SamlAuthnRequestContainerDto samlAuthnRequestContainerDto = new SamlAuthnRequestContainerDto(samlRequestDto.getSamlRequest(), Optional.ofNullable(samlRequestDto.getRelayState()), samlRequestDto.getPrincipalIpAsSeenByFrontend());

    SessionId sessionId = sessionProxy.createSession(samlAuthnRequestContainerDto);
    return Response.ok(sessionId).build();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:25,代码来源:SamlMessageReceiverApi.java

示例3: log

import org.slf4j.event.Level; //导入依赖的package包/类
private void log(Level level, String format, Object[] argArray) {
    switch (level) {
        case TRACE:
            logger.trace(format, argArray);
            break;
        case DEBUG:
            logger.debug(format, argArray);
            break;
        case INFO:
            logger.info(format, argArray);
            break;
        case WARN:
            logger.warn(format, argArray);
            break;
        case ERROR:
            logger.error(format, argArray);
            break;
    }

}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:21,代码来源:LoggerBolt.java

示例4: debug_format_argSupplier1

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void debug_format_argSupplier1() throws Exception {
    lambdaLogger.debug("debug format", () -> "arg1");

    verify(lambdaLogger).doLog(eq(null), eq(Level.DEBUG), eq("debug format"), argSuppliersCaptor.capture(), eq(null));

    Supplier[] suppliers = argSuppliersCaptor.getValue();
    assertThat(suppliers.length).isEqualTo(1);
    assertThat(suppliers[0].get()).isEqualTo("arg1");
}
 
开发者ID:kwon37xi,项目名称:slf4j-lambda,代码行数:11,代码来源:LambdaLoggerTest.java

示例5: handle_shouldNotifyPolicyWhenSamlStringCannotBeConvertedToAnElement

import org.slf4j.event.Level; //导入依赖的package包/类
@Test(expected=SamlTransformationErrorException.class)
public void handle_shouldNotifyPolicyWhenSamlStringCannotBeConvertedToAnElement() throws Exception {
    final SamlResponseDto samlResponse = new SamlResponseDto("Woooo!");
    when(responseUnmarshaller.apply(samlResponse.getSamlResponse())).thenThrow(new SamlTransformationErrorException("not xml", Level.ERROR));
    matchingServiceResponseTranslatorService.translate(samlResponse);
    // event sink logging is tested in SamlTransformationErrorExceptionMapperTest
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:8,代码来源:MatchingServiceResponseTranslatorServiceTest.java

示例6: error_marker_msgSupplier_throwable

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void error_marker_msgSupplier_throwable() throws Exception {
    lambdaLogger.error(testMarker, () -> "error message sup", testException);

    verify(lambdaLogger).doLog(eq(testMarker), eq(Level.ERROR), msgSupplierCaptor.capture(), eq(testException));

    assertThat(msgSupplierCaptor.getValue().get()).isEqualTo("error message sup");
}
 
开发者ID:kwon37xi,项目名称:slf4j-lambda,代码行数:9,代码来源:LambdaLoggerTest.java

示例7: setDebugMode

import org.slf4j.event.Level; //导入依赖的package包/类
public void setDebugMode(boolean on) {
    if(on) {
        setLoggerLevel("com.paypal.butterfly", Level.DEBUG);
    } else {
        setLoggerLevel("com.paypal.butterfly", Level.INFO);
    }
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogConfigurator.java

示例8: testVerboseOn

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testVerboseOn() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setDebugMode(true);
    Assert.assertTrue(loggerContext.getLogger("com.paypal.butterfly").getLevel() == ch.qos.logback.classic.Level.DEBUG);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例9: testLoggerAsStringAndLogBackLevelAsInfo

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testLoggerAsStringAndLogBackLevelAsInfo() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel("com.paypal.butterfly.cli", Level.INFO);
    Assert.assertTrue(loggerContext.getLogger("com.paypal.butterfly.cli").getLevel() == ch.qos.logback.classic.Level.INFO);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例10: testLoggerAsStringAndLogBackLevelAsInfoWithWrongPackage

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testLoggerAsStringAndLogBackLevelAsInfoWithWrongPackage() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel("com.paypal.butterfly.cli", Level.INFO);
    Assert.assertFalse(loggerContext.getLogger("com.paypal.butterfly.cli.test").getLevel() == ch.qos.logback.classic.Level.INFO);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例11: testLoggerAsStringAndLogBackLevelAsDebug

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testLoggerAsStringAndLogBackLevelAsDebug() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel("com.paypal.butterfly.cli", Level.DEBUG);
    Assert.assertTrue(loggerContext.getLogger("com.paypal.butterfly.cli").getLevel() == ch.qos.logback.classic.Level.DEBUG);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例12: info_marker_format_argSupplier1

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void info_marker_format_argSupplier1() throws Exception {
    lambdaLogger.info(testMarker, "info format", () -> "arg1");

    verify(lambdaLogger).doLog(eq(testMarker), eq(Level.INFO), eq("info format"), argSuppliersCaptor.capture(), eq(null));

    Supplier[] suppliers = argSuppliersCaptor.getValue();
    assertThat(suppliers.length).isEqualTo(1);
    assertThat(suppliers[0].get()).isEqualTo("arg1");
}
 
开发者ID:kwon37xi,项目名称:slf4j-lambda,代码行数:11,代码来源:LambdaLoggerTest.java

示例13: testLoggerAsClassAndLogBackLevelAsInfo

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testLoggerAsClassAndLogBackLevelAsInfo() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel(this.getClass(), Level.INFO);
    Assert.assertTrue(loggerContext.getLogger(this.getClass()).getLevel() == ch.qos.logback.classic.Level.INFO);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例14: testLoggerAsClassAndLogBackLevelAsWarn

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void testLoggerAsClassAndLogBackLevelAsWarn() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel(this.getClass(), Level.WARN);
    Assert.assertTrue(loggerContext.getLogger(this.getClass()).getLevel() == ch.qos.logback.classic.Level.WARN);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例15: doLog_format_argSuppliers_enabled

import org.slf4j.event.Level; //导入依赖的package包/类
@Test
public void doLog_format_argSuppliers_enabled() throws Exception {
    when(underlyingLogger.isInfoEnabled(testMarker)).thenReturn(true);

    lambdaLogger.doLog(testMarker, Level.INFO, "message format", new Supplier<?>[] { () -> "hello", () -> "world" }, testException);

    verify(underlyingLogger, times(1)).log(testMarker, FQCN, Level.INFO.toInt(), "message format", new Object[] { "hello", "world" },
        testException);
}
 
开发者ID:kwon37xi,项目名称:slf4j-lambda,代码行数:10,代码来源:LambdaLoggerLocationAwareImplTest.java


注:本文中的org.slf4j.event.Level类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。