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


Java Log类代码示例

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


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

示例1: eval

import jline.internal.Log; //导入依赖的package包/类
public Object eval(ScriptObject o, Object scope, String source, boolean returnStuff) {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'eval' in local mode");
        return "";
    }
    try {
        //new jdk.nashorn.internal.runtime.DebugLogger().
        Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
        //note: getConstructor() can return only public constructors,
        //you need to use

        Method method = c.getDeclaredMethod("eval", ScriptObject.class, Object.class, String.class, boolean.class);

        //Constructor<?> constructor = c.getDeclaredConstructor();
        method.setAccessible(true);
        return method.invoke(null, o, scope, source, returnStuff);
    } catch (Exception e) {
        Log.error(e);
        return null;
    }
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:22,代码来源:JavaToJsHelpers.java

示例2: getDebugSupport

import jline.internal.Log; //导入依赖的package包/类
private Object getDebugSupport() {


        //return new NashornDebugHelper();
        try {
            Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
            //note: getConstructor() can return only public constructors,
            //you need to use
            Method method = c.getDeclaredMethod("eval", ScriptObject.class, Object.class, String.class, boolean.class);

            //Constructor<?> constructor = c.getDeclaredConstructor();
            method.setAccessible(true);
            return method;
            //constructor.setAccessible(true);
            //Object o = constructor.newInstance(null);
            //return o;
        } catch (Exception e) {
            Log.error(e);
            return null;
        }
    }
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:22,代码来源:JavaToJsHelpers.java

示例3: update

import jline.internal.Log; //导入依赖的package包/类
public void update(String subreddit, String storyId, String storyURL, String storyTitle, String commentId,
		String comment, int sentimentScore, long timestamp) {
	
	StoryData story = stories.get(storyId);
	if (story == null) {
		story = new StoryData();
		story.subreddit = subreddit;
		story.storyId = storyId;
		story.storyURL = storyURL;
		story.storyTitle = storyTitle;
		stories.put(storyId, story);
	}
	
	story.update(commentId, comment, sentimentScore, timestamp);
	
	// Discard stories that have not received any comment during the time window.
	long curTimestamp = System.currentTimeMillis();
	for (Iterator<StoryData> itr = stories.values().iterator(); itr.hasNext();) {
		StoryData s = itr.next();
		if (curTimestamp - s.lastCommentTimestamp > TIME_WINDOW) {
			Log.info("No comment received for {}:{}. Discarding", s.storyId, s.storyURL);
			itr.remove();
		}
	}
}
 
开发者ID:pathbreak,项目名称:reddit-sentiment-storm,代码行数:26,代码来源:Summary.java

示例4: run

import jline.internal.Log; //导入依赖的package包/类
@Override
    public void run(IFloraOn driver) throws FloraOnException, IOException {
        Log.info("Updating red list dataset for " + territory);
        Iterator<RedListDataEntity> rldel = driver.getRedListData().getAllRedListData(territory, false, null);
        Map<String, Object> v = new HashMap<>();

        while(rldel.hasNext()) {
        RedListDataEntity rlde = rldel.next();
            InferredStatus is = driver.wrapTaxEnt(driver.asNodeKey(rlde.getTaxEntID())).getInferredNativeStatus(territory);
//            rlde.setInferredStatus(is);
//            INodeKey nk = driver.asNodeKey(rlde.getID());
//            driver.getRedListData().updateRedListDataEntity(territory, nk, rlde, false);
            v.clear();
            v.put("inferredStatus", is);
            driver.getRedListData().updateRedListDataEntities(territory, new String[] {rlde.getTaxEntID()}, v);
            n++;
        }

    }
 
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:20,代码来源:UpdateNativeStatusJob.java

示例5: hashCode

import jline.internal.Log; //导入依赖的package包/类
@Override
public int hashCode() {
    if(keyFields != null && keyFields.size() > 0) {
        switch(keyFields.size()) {
            case 1:
                return properties.get(keyFields.iterator().next()).hashCode();
            case 2:
                Iterator<String> it = keyFields.iterator();
                String a = it.next();
                String b = it.next();
                return Objects.hash(properties.get(a), properties.get(b));
            default:
                Log.warn("Not implemented");
                return 0;   // FIXME
        }
    } else {
        int result = Arrays.hashCode(points);
        result = 31 * result + (properties != null ? properties.hashCode() : 0);
        return result;
    }
}
 
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:22,代码来源:Polygon.java

示例6: stringArrayToEnumArray

import jline.internal.Log; //导入依赖的package包/类
public static <T extends Enum<T>> T[] stringArrayToEnumArray(String[] stringArray, Class<T> clazz) {
    List<T> tmp = new ArrayList<>();
    boolean addNull = false;
    for(String s : stringArray) {
        if(s == null || s.length() == 0) {
            addNull = true;
            continue;
        }
        try {
            tmp.add(T.valueOf(clazz, s));
        } catch (IllegalArgumentException e) {
            Log.warn("Enum value " + s + " not found in " + clazz.toString());
        }
    }

    // this is to distinguish between a null value and an empty array
    if(tmp.size() == 0 && addNull) tmp.add(null);
    return tmp.toArray((T[]) Array.newInstance(clazz, tmp.size()));
}
 
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:20,代码来源:StringUtils.java

示例7: deserialize

import jline.internal.Log; //导入依赖的package包/类
@Override
public T deserialize(VPackSlice parent, VPackSlice vpack, VPackDeserializationContext vPackDeserializationContext) throws VPackException {
    String v;
    if(vpack.getType() == ValueType.INT || vpack.getType() == ValueType.UINT || vpack.getType() == ValueType.SMALLINT)
        v = ((Integer) vpack.getAsInt()).toString();
    else if(vpack.getType() == ValueType.DOUBLE)
        v = ((Double) vpack.getAsDouble()).toString();
    else if(vpack.getType() == ValueType.BOOL)
        v = ((Boolean) vpack.getAsBoolean()).toString().toUpperCase();
    else
        v = vpack.getAsString();

    if(v.equals("")) return nullValue;
    try {
        return (T) T.valueOf(tClass, v);
    } catch (IllegalArgumentException e) {
        Log.warn("Value " + v + " not found in enum constant.");
        return nullValue;
    }

}
 
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:22,代码来源:SafeEnumDeserializer.java

示例8: main

import jline.internal.Log; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
    Log.setOutput( new PrintStream( ByteStreams.nullOutputStream() ) );
    AnsiConsole.systemInstall();
    consoleReader = new ConsoleReader();
    consoleReader.setExpandEvents( false );

    logger = new BungeeLogger();
    System.setErr( new PrintStream( new LoggingOutputStream( logger, Level.SEVERE ), true ) );
    System.setOut( new PrintStream( new LoggingOutputStream( logger, Level.INFO ), true ) );

    instance = new ChunkrServer();

    while ( isRunning )
    {
        String line = consoleReader.readLine( ">" );
        if ( line != null )
        {
            if ( !getInstance().getPluginManager().dispatchCommand( line ) )
            {
                logger.info( "Command not found" );
            }
        }
    }
}
 
开发者ID:Chnkr,项目名称:ChunkrConnect,代码行数:26,代码来源:ChunkrServer.java

示例9: flush

import jline.internal.Log; //导入依赖的package包/类
public void flush() throws IOException {
    Log.trace("Flushing history");

    if (!file.exists()) {
        File dir = file.getParentFile();
        if (!dir.exists() && !dir.mkdirs()) {
            Log.warn("Failed to create directory: ", dir);
        }
        if (!file.createNewFile()) {
            Log.warn("Failed to create file: ", file);
        }
    }

    PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file)));
    try {
        for (Entry entry : this) {
            out.println(entry.value());
        }
    }
    finally {
        out.close();
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:24,代码来源:FileHistory.java

示例10: setEchoEnabled

import jline.internal.Log; //导入依赖的package包/类
@Override
public synchronized void setEchoEnabled(final boolean enabled) {
    try {
        if (enabled) {
            settings.set("echo");
        }
        else {
            settings.set("-echo");
        }
        super.setEchoEnabled(enabled);
    }
    catch (Exception e) {
        if (e instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        Log.error("Failed to ", (enabled ? "enable" : "disable"), " echo", e);
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:UnixTerminal.java

示例11: bake

import jline.internal.Log; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	final IModel model = loadBaseModel(state, format, bakedTextureGetter);

	IBlockState blockState = null;

	if (defaultBlockState.isPresent()) {
		final Block defaultBlock = Block.REGISTRY.getObject(defaultBlockState.get());
		if (defaultBlock != Blocks.AIR) {
			blockState = defaultBlock.getDefaultState();
			if (!(blockState instanceof IExtendedBlockState) ||
					!((IExtendedBlockState)blockState).getUnlistedNames().contains(EvalModelState.PROPERTY)) {
				Log.warn("State %s does not contain eval state property", blockState);
			}
		} else {
			Log.warn("Can't find default block: %s", defaultBlockState.get());
		}
	}

	final IVarExpander expander = evaluatorFactory.createExpander();
	return new BakedEvalExpandModel(model, state, format, bakedTextureGetter, blockState, expander);
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:23,代码来源:EvalExpandModel.java

示例12: getInput

import jline.internal.Log; //导入依赖的package包/类
public String getInput(String prompt) throws Exception {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'getInput' in local mode");
        return "";
    }

    ConsoleReader reader = new ConsoleReader();
    return reader.readLine(prompt);
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:10,代码来源:JavaToJsHelpers.java

示例13: inspect

import jline.internal.Log; //导入依赖的package包/类
public Object inspect(Object object) throws Exception {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'inspect' in local mode");
        return "";
    }
    Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
    //note: getConstructor() can return only public constructors,
    //you need to use

    Method method = c.getDeclaredMethod("valueInfos", Object.class, boolean.class);
    //valueInfos(Object object, boolean all)
    //Constructor<?> constructor = c.getDeclaredConstructor();
    method.setAccessible(true);
    Object[] objects = (Object[])method.invoke(null, object, true);
    //List<Map> returnObjects = new ArrayList<>();
    Map desc = new HashMap<>();
    for(Object o: objects) {
        Map map = new HashMap<>();

        Field field = o.getClass().getDeclaredField("key");
        field.setAccessible(true);
        Object key = field.get(o);

        Field field2 = o.getClass().getDeclaredField("valueAsString");
        field2.setAccessible(true);
        Object val = field2.get(o);
        desc.put(key.toString(), val.toString());

    }
    return desc;
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:32,代码来源:JavaToJsHelpers.java

示例14: createUrlPath

import jline.internal.Log; //导入依赖的package包/类
protected String createUrlPath(int timeoutMs, int limit) {
	final StringBuilder url = new StringBuilder(CambriaPublisherUtility.makeConsumerUrl(fTopic, fGroup, fId));
	final StringBuilder adds = new StringBuilder();
	if (timeoutMs > -1) {
		adds.append("timeout=").append(timeoutMs);
	}

	if (limit > -1) {
		if (adds.length() > 0) {
			adds.append("&");
		}
		adds.append("limit=").append(limit);
	}
	if (fFilter != null && fFilter.length() > 0) {
		try {
			if (adds.length() > 0) {
				adds.append("&");
			}
			adds.append("filter=").append(URLEncoder.encode(fFilter, "UTF-8"));
		} catch (UnsupportedEncodingException e) {
			Log.error("Failed due to UnsupportedEncodingException" + e);
		}
	}
	if (adds.length() > 0) {
		url.append("?").append(adds.toString());
	}
	return url.toString();
}
 
开发者ID:att,项目名称:dmaap-framework,代码行数:29,代码来源:DMaaPCambriaConsumerImpl.java

示例15: syncConfig

import jline.internal.Log; //导入依赖的package包/类
public static void syncConfig() {
    try {
        processConfig();
    } catch (Exception e) {
        Log.error(MODID + " has a problem loading its configuration!");
        e.printStackTrace();
    } finally {
        if(config.hasChanged()) {
            config.save();
        }
    }
}
 
开发者ID:Tbsc,项目名称:TbscFPS,代码行数:13,代码来源:TbscFPS.java


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