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


Java SimpleLog类代码示例

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


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

示例1: onLog

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
@Override
public void onLog(SimpleLog simpleLog, SimpleLog.Level logLevel, Object message) {
	Logger log = convert(simpleLog);
	switch (logLevel) {
		case TRACE:
			if (log.isTraceEnabled()) {
				log.trace(message.toString());
			}
			break;
		case DEBUG:
			if (log.isDebugEnabled()) {
				log.debug(message.toString());
			}
			break;
		case INFO:
			log.info(message.toString());
			break;
		case WARNING:
			log.warn(message.toString());
			break;
		case FATAL:
			log.error(message.toString());
			break;
	}
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:26,代码来源:SimpleLogToSLF4JAdapter.java

示例2: initialize

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
private void initialize()
{
	this.commandQueue 	= new LinkedList<Command>();
	this.log 			= SimpleLog.getLog("WeenieBot");
	this.isLocked		= false;
	
	// Load the properties from prop.properties
	loadProperties();
	
	// Initialize the sound library and player
	this.library = new SoundLibrary(properties.getProperty("directory", "sounds"));
	this.player = new SoundPlayer();
	
	initializeBot();
	
	// Schedule the command timer <Default 1 second ticks>
	commandTimer = new Timer();
	commandTimer.scheduleAtFixedRate(new Tick(), 0, 1000);
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:20,代码来源:WeenieBot.java

示例3: loadData

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
public void loadData() {
    samaritan.getLogger().writeFrom("Quote Handler", "Loading channel histories...");
    for (TextChannel messageChannel : jda.getTextChannels()) {
        try {
            List<Message> messages = new ArrayList<>();
            MessageHistory messageHistory = new MessageHistory(messageChannel);
            RestAction.LOG.setLevel(SimpleLog.LEVEL.OFF);
            messageHistory.retrievePast(100).queue((messageList) -> {
                messages.addAll(messageHistory.getCachedHistory());
                messageChannelListMap.put(messageChannel, messages);
            });

        } catch (Exception exc) {
        }
    }
}
 
开发者ID:iSach,项目名称:Samaritan,代码行数:17,代码来源:QuoteHandler.java

示例4: initJda

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
/**
 * Starts JDA.
 *
 * @return {@code true} if everything went well, {@code false} otherwise.
 */
private boolean initJda() {

    try {
        SimpleLog.Level level = JDAImpl.LOG.getLevel();
        SimpleLog.Level socketLevel = WebSocketClient.LOG.getLevel();
        JDAImpl.LOG.setLevel(SimpleLog.Level.OFF);
        WebSocketClient.LOG.setLevel(SimpleLog.Level.OFF);

        jda = new JDABuilder(AccountType.BOT).setToken(botToken).buildBlocking();
        jda.getPresence().setGame(Game.of("2.0.2"));
        logger.writeFrom("jda", "Successfully connected!");
        logger.writeFrom("jda WebSocket", "Connected to WebSocket!");

        JDAImpl.LOG.setLevel(level);
        WebSocketClient.LOG.setLevel(socketLevel);
    } catch (LoginException | InterruptedException | RateLimitedException e) {
        logger.writeFrom("jda", "Couldn't connect!");
        e.printStackTrace();
        return false;
    }
    return true;
}
 
开发者ID:iSach,项目名称:Samaritan,代码行数:28,代码来源:Samaritan.java

示例5: SoundPlayer

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
public SoundPlayer()
{
	log = SimpleLog.getLog("SoundPlayer");
	
	playerManager = new DefaultAudioPlayerManager();
	playerManager.getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality.MEDIUM);
	playerManager.registerSourceManager(new LocalAudioSourceManager());
	player = playerManager.createPlayer();
	player.addListener(this);
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:11,代码来源:SoundPlayer.java

示例6: DiscordAPI

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
private DiscordAPI() {
    SimpleLog JDASocketLog = SimpleLog.getLog("JDASocket");
    JDASocketLog.setLevel(SimpleLog.Level.OFF);

    SimpleLog JDALog = SimpleLog.getLog("JDA");
    JDALog.setLevel(SimpleLog.Level.OFF);

    Thread.setDefaultUncaughtExceptionHandler(com.gmt2001.UncaughtExceptionHandler.instance());
}
 
开发者ID:GloriousEggroll,项目名称:quorrabot,代码行数:10,代码来源:DiscordAPI.java

示例7: install

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
public static void install() {
	SimpleLog.addListener(new SimpleLogToSLF4JAdapter());
	SimpleLog.LEVEL = SimpleLog.Level.OFF;
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:5,代码来源:SimpleLogToSLF4JAdapter.java

示例8: onError

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
@Override
public void onError(SimpleLog simpleLog, Throwable err) {
	convert(simpleLog).error("An exception occurred", err);
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:5,代码来源:SimpleLogToSLF4JAdapter.java

示例9: convert

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
private Logger convert(SimpleLog log) {
	return logS.computeIfAbsent(log, ignored -> LoggerFactory.getLogger(log.name));
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:4,代码来源:SimpleLogToSLF4JAdapter.java

示例10: ChatListener

import net.dv8tion.jda.core.utils.SimpleLog; //导入依赖的package包/类
public ChatListener(String toggleChar, int maxMessageSize)
{
	this.toggleChar 	= toggleChar;
	this.maxMessageSize = maxMessageSize;
	log = SimpleLog.getLog("ChatListener");
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:7,代码来源:ChatListener.java


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