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


Java Logger.debug方法代码示例

本文整理汇总了Java中com.jcabi.log.Logger.debug方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.debug方法的具体用法?Java Logger.debug怎么用?Java Logger.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jcabi.log.Logger的用法示例。


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

示例1: processSubevents

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Processes subevents of the key.
 * @param key That has new events.
 * @param dir For the key.
 * @throws IOException If a subdirectory cannot be registered.
 */
private void processSubevents(final WatchKey key, final Path dir)
    throws IOException {
    for (final WatchEvent event : key.pollEvents()) {
        final WatchEvent.Kind kind = event.kind();
        final Path name = (Path) event.context();
        final Path child = dir.resolve(name);
        Logger.debug(
            this,
            "%s: %s%n", event.kind().name(), child
        );
        if (kind == ENTRY_CREATE) {
            try {
                if (Files.isDirectory(child)) {
                    this.processSubevents(child);
                }
            } catch (final IOException ex) {
                throw new IOException(
                    "Failed to register subdirectories.",
                    ex
                );
            }
        }
    }
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:31,代码来源:WatchDirs.java

示例2: firstValid

import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
@Cacheable(forever = true)
public byte[] firstValid() throws IOException {
    byte[] result = new byte[0];
    for (final ByteArray array : this.arrays) {
        try {
            result = array.toByteArray();
            break;
        } catch (final IOException ignored) {
            Logger.debug(this, ignored.getMessage());
        }
    }
    if (result.length == 0) {
        throw new IOException("No valid ByteArray found.");
    }
    return result;
}
 
开发者ID:driver733,项目名称:VKMusicUploader,代码行数:18,代码来源:FallbackByteArray.java

示例3: execType

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Executing data to Twitch PubSub
 * @param type data type ("LISTEN" or "UNLISTEN")
 * @param topics string {@link List} of topics
 */
private void execType(String type, List<String> topics) {
	// Check Connection
	if (!getConnectionState().equals(TMIConnectionState.CONNECTED)) {
		return;
	}

	ObjectMapper mapper = new ObjectMapper();
	ObjectNode node = mapper.createObjectNode();
	node.put("type", type.toUpperCase())
			.put("nonce", identifyNonce);
	ArrayNode topicList = mapper.createArrayNode();
	topics.forEach(topicList::add);
	node.putObject("data")
			.put("auth_token", "") // TODO: OAuth if exist.
			.putArray("topics").addAll(topicList);
	Logger.debug(this, "Sending to PubSub - type: %s, topics: [ %s ]", type.toUpperCase(), String.join(", ", topics));
	webSocket.sendText(node.toString());
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:24,代码来源:TwitchPubSub.java

示例4: sendMessage

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Sending message to the joined channel
 * @param channel channel name
 * @param message message
 */
public void sendMessage(String channel, String message) {
	Logger.debug(this, "Sending message to channel [%s] with content [%s].!", channel, message);
	new Thread(() -> {
		// Consume 1 Token (wait's in case the limit has been exceeded)
		if (isModerator(channel)) {
			// Only for channels if bot is moderator
			modMessageBucket.get(channel).consume(1);
		} else {
			messageBucket.consume(1);
		}

		// Send Message
		sendCommand("privmsg", "#" + channel, ":" + message);

		// Logging
		Logger.debug(this, "Message send to Channel [%s] with content [%s].", channel, message);
	}).start();
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:24,代码来源:TwitchChat.java

示例5: addAnyCredential

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Adds any Credentials to the Credential Manager
 *
 * @param key        Key
 * @param credential Credential Instance
 */
private void addAnyCredential(String key, OAuthCredential credential) {
	// Remove value if it exists
	if (getOAuthCredentials().containsKey(key)) {
		Logger.debug(this, "Credentials with key [%s] already present in CredentialManager.", key);
		getOAuthCredentials().remove(key);
	}

	// Add value
	Logger.debug(this, "Added Credentials with key [%s] and data [%s]", key, credential.toString());

	getOAuthCredentials().put(key, credential);

	// Store - if autoSaving was enabled
	if (getSaveCredentials()) {
		saveToFile();
	}
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:24,代码来源:CredentialManager.java

示例6: loadFromFile

import com.jcabi.log.Logger; //导入方法依赖的package包/类
private void loadFromFile() {
	if (getCredentialFile() != null) {
		// Clear present credentials
		getOAuthCredentials().clear();

		// Load credentials from file
		try {
			ObjectMapper mapper = new ObjectMapper();
			Map<String, OAuthCredential> loadedCredentials = mapper.readValue(getCredentialFile(), new TypeReference<LinkedHashMap<String, OAuthCredential>>() {
			});
			getOAuthCredentials().putAll(loadedCredentials);

			Logger.debug(this, "Loaded %d Credentials using the CredentialManager.", oAuthCredentials.size());

		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:20,代码来源:CredentialManager.java

示例7: unregisterListener

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Unregisters a listener using {@link EventSubscriber} method annotations.
 *
 * @param listener The listener.
 */
@SuppressWarnings("rawtypes")
public void unregisterListener(Object listener) {
	for (Method method : listener.getClass().getMethods()) {
		if (method.getParameterCount() == 1) {
			Class<?> eventClass = method.getParameterTypes()[0];
			if (Event.class.isAssignableFrom(eventClass)) {
				if (methodListeners.containsKey(eventClass)) {
					if (methodListeners.get(eventClass).containsKey(method)) {
						methodListeners.get(eventClass).get(method).removeIf((ListenerPair pair) -> pair.listener == listener); //Yes, the == is intentional. We want the exact same instance.

						Logger.debug(this, "Unregistered method listener %s#%s", listener.getClass().getSimpleName(), method.toString());
					}
				}
			}
		}
	}
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:23,代码来源:EventDispatcher.java

示例8: copy

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Copy files from source to temp directory.
 * @param src The source to compile
 * @param dir The directory to copy to
 * @throws IOException If some error
 */
@SuppressWarnings("PMD.UseConcurrentHashMap")
private void copy(final Source src, final File dir) throws IOException {
    final Map<String, URL> files = src.files();
    for (final Map.Entry<String, URL> entry : files.entrySet()) {
        final File file = new File(dir, entry.getKey());
        if (file.getParentFile().mkdirs()) {
            Logger.info(this, "directories created for %s", file);
        }
        FileUtils.copyURLToFile(entry.getValue(), file);
    }
    Logger.debug(
        this, "#copy('%s', '%s'): copied %d files: %[list]s",
        src, dir, files.size(), files.keySet()
    );
}
 
开发者ID:jcabi,项目名称:jcabi-latex-maven-plugin,代码行数:22,代码来源:Compiler.java

示例9: response

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Get response from file.
 * @param req Request
 * @param file File to read
 * @return Response
 * @throws IOException If fails
 */
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private Response response(final Request req, final File file)
    throws IOException {
    final JsonObject json = Json.createReader(
        new ByteArrayInputStream(
            FileUtils.readFileToByteArray(file)
        )
    ).readObject();
    final List<Map.Entry<String, String>> map = new LinkedList<>();
    final JsonObject headers = json.getJsonObject("headers");
    for (final String name : headers.keySet()) {
        for (final JsonString value
            : headers.getJsonArray(name).getValuesAs(JsonString.class)) {
            map.add(new AbstractMap.SimpleEntry<>(name, value.getString()));
        }
    }
    Logger.debug(this, "cache loaded from %s", file);
    return new DefaultResponse(
        req,
        json.getInt("status"),
        json.getString("reason"),
        new Array<>(map),
        json.getString("body").getBytes("UTF-8")
    );
}
 
开发者ID:jcabi,项目名称:jcabi-http,代码行数:33,代码来源:FcCache.java

示例10: saved

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Save response to file.
 * @param response Response to save
 * @param file File to read
 * @return Response
 * @throws IOException If fails
 */
private Response saved(final Response response, final File file)
    throws IOException {
    final JsonObjectBuilder json = Json.createObjectBuilder();
    json.add("status", response.status());
    json.add("reason", response.reason());
    final JsonObjectBuilder headers = Json.createObjectBuilder();
    for (final Map.Entry<String, List<String>> pair
        : response.headers().entrySet()) {
        final JsonArrayBuilder array = Json.createArrayBuilder();
        for (final String value : pair.getValue()) {
            array.add(value);
        }
        headers.add(pair.getKey(), array);
    }
    json.add("headers", headers);
    json.add("body", response.body());
    if (file.getParentFile().mkdirs()) {
        Logger.debug(this, "directory created for %s", file);
    }
    try (final OutputStream out = new FileOutputStream(file)) {
        Json.createWriter(out).write(json.build());
    }
    Logger.debug(this, "cache saved into %s", file);
    return response;
}
 
开发者ID:jcabi,项目名称:jcabi-http,代码行数:33,代码来源:FcCache.java

示例11: findIn

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Find bytecode file in the directory and return its content.
 * @param dir The directory
 * @return The bytecode
 * @throws IOException If some problem
 */
public byte[] findIn(final File dir) throws IOException {
    final Collection<File> produced = FileUtils.listFiles(
        dir, new String[] {"class"}, true
    );
    if (produced.isEmpty()) {
        throw new IllegalStateException("No files generated");
    }
    final File found = produced.iterator().next();
    final byte[] bytes = FileUtils.readFileToByteArray(found);
    Logger.debug(
        this,
        "#findIn('%s'): found file '%s' with %d bytes",
        dir,
        found,
        bytes.length
    );
    return bytes;
}
 
开发者ID:teamed,项目名称:qulice,代码行数:25,代码来源:BytecodeMocker.java

示例12: classloader

import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public ClassLoader classloader() {
    final List<URL> urls = new LinkedList<>();
    for (final String path : this.classpath()) {
        try {
            urls.add(
                URI.create(String.format("file:///%s", path)).toURL()
            );
        } catch (final MalformedURLException ex) {
            throw new IllegalStateException("Failed to build URL", ex);
        }
    }
    final URLClassLoader loader = AccessController.doPrivilegedWithCombiner(
        new DefaultMavenEnvironment.PrivilegedClassLoader(urls)
    );
    for (final URL url : loader.getURLs()) {
        Logger.debug(this, "Classpath: %s", url);
    }
    return loader;
}
 
开发者ID:teamed,项目名称:qulice,代码行数:21,代码来源:DefaultMavenEnvironment.java

示例13: description

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Get environment description of this.
 * @return The description
 */
private EnvironmentDescription description() {
    final DescribeEnvironmentsResult res = this.client.describeEnvironments(
        new DescribeEnvironmentsRequest()
            .withEnvironmentIds(this.eid)
    );
    if (res.getEnvironments().isEmpty()) {
        throw new DeploymentException(
            String.format("environment '%s' not found", this.eid)
        );
    }
    final EnvironmentDescription desc = res.getEnvironments().get(0);
    Logger.debug(
        this,
        // @checkstyle LineLength (1 line)
        "ID=%s, env=%s, app=%s, CNAME=%s, label=%s, template=%s, status=%s, health=%s",
        desc.getEnvironmentId(), desc.getEnvironmentName(),
        desc.getApplicationName(), desc.getCNAME(),
        desc.getVersionLabel(), desc.getTemplateName(), desc.getStatus(),
        desc.getHealth()
    );
    return desc;
}
 
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:27,代码来源:Environment.java

示例14: chmod

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Change file permissions.
 * @param file The file to change
 * @param mode Permissions to set
 * @throws IOException If some error inside
 * @see http://stackoverflow.com/questions/664432
 * @see http://stackoverflow.com/questions/1556119
 */
private void chmod(final File file, final int mode) throws IOException {
    new VerboseProcess(
        new ProcessBuilder(
            "chmod",
            String.format("%04o", mode),
            file.getAbsolutePath()
        )
    ).stdout();
    Logger.debug(
        this,
        "chmod(%s, %3o): succeeded",
        file,
        mode
    );
}
 
开发者ID:jcabi,项目名称:jcabi-heroku-maven-plugin,代码行数:24,代码来源:Git.java

示例15: xmlRootElement

import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
 * Create new <tt>XmlRootElement</tt> annotation.
 * @param file Javassist file to work with
 * @param name Name of root element
 * @return The annotation
 */
private static Annotation xmlRootElement(final ClassFile file,
    final String name) {
    final AnnotationsAttribute attribute = AnnotationsAttribute.class.cast(
        file.getAttribute(AnnotationsAttribute.visibleTag)
    );
    final Annotation annotation = attribute.getAnnotation(
        XmlRootElement.class.getName()
    );
    annotation.addMemberValue(
        "name",
        new StringMemberValue(name, file.getConstPool())
    );
    Logger.debug(
        JaxbGroup.class,
        "#xmlRootElement(.., '%s'): annotation created",
        name
    );
    return annotation;
}
 
开发者ID:yegor256,项目名称:rexsl,代码行数:26,代码来源:JaxbGroup.java


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