Search in sources :

Example 1 with AuditLoggerFactory

use of com.yahoo.athenz.common.server.log.AuditLoggerFactory in project athenz by yahoo.

the class AuditLogMsgBuilderTest method starter.

DefaultAuditLogMsgBuilder starter(final String whatApi) {
    AuditLoggerFactory auditLoggerFactory = new DefaultAuditLoggerFactory();
    AuditLogger logger = auditLoggerFactory.create();
    AuditLogMsgBuilder msgBldr = logger.getMsgBuilder();
    msgBldr.who(TOKEN_STR).when("now-timestamp").clientIp("12.12.12.12").whatApi(whatApi);
    return (DefaultAuditLogMsgBuilder) msgBldr;
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLoggerFactory(com.yahoo.athenz.common.server.log.AuditLoggerFactory) AuditLogger(com.yahoo.athenz.common.server.log.AuditLogger) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder) DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder)

Example 2 with AuditLoggerFactory

use of com.yahoo.athenz.common.server.log.AuditLoggerFactory in project athenz by yahoo.

the class AuditLoggerTest method testLogMsgBuilder.

@Test
public void testLogMsgBuilder() {
    AuditLoggerFactory auditLoggerFactory = new DefaultAuditLoggerFactory();
    AuditLogger logger = auditLoggerFactory.create();
    AuditLogMsgBuilder msgBldr = logger.getMsgBuilder();
    auditLogger.log(msgBldr);
}
Also used : AuditLoggerFactory(com.yahoo.athenz.common.server.log.AuditLoggerFactory) AuditLogger(com.yahoo.athenz.common.server.log.AuditLogger) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder) Test(org.testng.annotations.Test)

Example 3 with AuditLoggerFactory

use of com.yahoo.athenz.common.server.log.AuditLoggerFactory in project athenz by yahoo.

the class AuditLoggerTest method testLogFactoryDefault.

@Test
public void testLogFactoryDefault() {
    AuditLoggerFactory auditLoggerFactory = new DefaultAuditLoggerFactory();
    AuditLogger logger = auditLoggerFactory.create();
    logger.log("Default logger succeeds", MSGVERS);
}
Also used : AuditLoggerFactory(com.yahoo.athenz.common.server.log.AuditLoggerFactory) AuditLogger(com.yahoo.athenz.common.server.log.AuditLogger) Test(org.testng.annotations.Test)

Example 4 with AuditLoggerFactory

use of com.yahoo.athenz.common.server.log.AuditLoggerFactory in project athenz by yahoo.

the class ZTSImpl method loadAuditLogger.

void loadAuditLogger() {
    String auditFactoryClass = System.getProperty(ZTSConsts.ZTS_PROP_AUDIT_LOGGER_FACTORY_CLASS, ZTSConsts.ZTS_AUDIT_LOGGER_FACTORY_CLASS);
    AuditLoggerFactory auditLogFactory = null;
    try {
        auditLogFactory = (AuditLoggerFactory) Class.forName(auditFactoryClass).newInstance();
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        LOGGER.error("Invalid AuditLoggerFactory class: " + auditFactoryClass + " error: " + e.getMessage());
        throw new IllegalArgumentException("Invalid audit logger class");
    }
    // create our audit logger
    auditLogger = auditLogFactory.create();
}
Also used : AuditLoggerFactory(com.yahoo.athenz.common.server.log.AuditLoggerFactory)

Example 5 with AuditLoggerFactory

use of com.yahoo.athenz.common.server.log.AuditLoggerFactory in project athenz by yahoo.

the class ZMSImpl method loadAuditLogger.

void loadAuditLogger() {
    String auditFactoryClass = System.getProperty(ZMSConsts.ZMS_PROP_AUDIT_LOGGER_FACTORY_CLASS, ZMSConsts.ZMS_AUDIT_LOGGER_FACTORY_CLASS);
    AuditLoggerFactory auditLogFactory = null;
    try {
        auditLogFactory = (AuditLoggerFactory) Class.forName(auditFactoryClass).newInstance();
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        LOG.error("Invalid AuditLoggerFactory class: " + auditFactoryClass + " error: " + e.getMessage());
        throw new IllegalArgumentException("Invalid audit logger class");
    }
    // create our audit logger
    auditLogger = auditLogFactory.create();
}
Also used : AuditLoggerFactory(com.yahoo.athenz.common.server.log.AuditLoggerFactory)

Aggregations

AuditLoggerFactory (com.yahoo.athenz.common.server.log.AuditLoggerFactory)5 AuditLogger (com.yahoo.athenz.common.server.log.AuditLogger)3 AuditLogMsgBuilder (com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)2 Test (org.testng.annotations.Test)2 DefaultAuditLogMsgBuilder (com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder)1