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


Java Log.i方法代码示例

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


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

示例1: startListener

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@ReactMethod
public void startListener() {
    if (listener == null) {
        if (allowedCredentials == null) {
            Log.i(TAG, "No credentials, so binding to localhost");
            Properties props = new Properties();
            props.put(Serve.ARG_BINDADDRESS, "localhost");
            listener = new LiteListener(manager, SUGGESTED_PORT, allowedCredentials, props);
        } else {
            listener = new LiteListener(manager, SUGGESTED_PORT, allowedCredentials);
        }

        Log.i(TAG, "Starting CBL listener on port " + listener.getListenPort());
    } else {
        Log.i(TAG, "Restarting CBL listener on port " + listener.getListenPort());
    }

    listener.start();
}
 
开发者ID:couchbaselabs,项目名称:react-native-couchbase-lite,代码行数:20,代码来源:ReactCBLite.java

示例2: getInfo

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public String getInfo(String key) {
    try {
        byte[][] metaNbody = forest.rawGet("info", key);
        return new String(metaNbody[1]);
    } catch (ForestException e) {
        // KEY NOT FOUND
        if (e.domain == ForestDBDomain &&
                e.code == FDBErrors.FDB_RESULT_KEY_NOT_FOUND) {
            Log.i(TAG, "[getInfo()] Key(\"%s\") is not found.", key);
        }
        // UNEXPECTED ERROR
        else {
            Log.e(TAG, "[getInfo()] Unexpected Error", e);
        }
        return null;
    }
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:19,代码来源:ForestDBStore.java

示例3: refreshRemoteCheckpointDoc

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Variant of -fetchRemoveCheckpointDoc that's used while replication is running, to reload the
 * checkpoint to get its current revision number, if there was an error saving it.
 */
@InterfaceAudience.Private
private void refreshRemoteCheckpointDoc() {
    Log.i(Log.TAG_SYNC, "%s: Refreshing remote checkpoint to get its _rev...", this);
    Future future = sendAsyncRequest("GET", "_local/" + remoteCheckpointDocID(), null, new RemoteRequestCompletion() {
        @Override
        public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
            if (db == null) {
                Log.w(Log.TAG_SYNC, "%s: db == null while refreshing remote checkpoint.  aborting", this);
                return;
            }
            if (e != null && Utils.getStatusFromError(e) != Status.NOT_FOUND) {
                Log.e(Log.TAG_SYNC, "%s: Error refreshing remote checkpoint", e, this);
            } else {
                Log.d(Log.TAG_SYNC, "%s: Refreshed remote checkpoint: %s", this, result);
                remoteCheckpoint = (Map<String, Object>) result;
                lastSequenceChanged = true;
                saveLastSequence();  // try saving again
            }
        }
    });
    pendingFutures.add(future);
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:27,代码来源:ReplicationInternal.java

示例4: notifyChangeListenersStateTransition

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void notifyChangeListenersStateTransition(
        Transition<ReplicationState, ReplicationTrigger> transition) {
    logTransition(transition);

    ReplicationStateTransition replStateTrans = new ReplicationStateTransition(transition);

    if ((TRANS_RUNNING_TO_IDLE.equals(replStateTrans)
            || TRANS_IDLE_TO_RUNNING.equals(replStateTrans)) && authenticating) {
        Log.i(TAG, "During middle of authentication, not notify Replicator state change");
        return;
    }

    // ignore RUNNING -> STOPPING as both are ACTIVE
    if (TRANS_RUNNING_TO_STOPPING.equals(replStateTrans)) {
        Log.v(TAG, "Both RUNNING and STOPPING are ACTIVE, not notify  Replicator state change");
        return;
    }

    Replication.ChangeEvent changeEvent = new Replication.ChangeEvent(this, replStateTrans);
    notifyChangeListeners(changeEvent);
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:22,代码来源:ReplicationInternal.java

示例5: getDatabase

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Instantiates a database but doesn't open the file yet.
 * in CBLManager.m
 * - (CBLDatabase*) _databaseNamed: (NSString*)name
 * mustExist: (BOOL)mustExist
 * error: (NSError**)outError
 *
 * @exclude
 */
@InterfaceAudience.Private
public Database getDatabase(String name, boolean mustExist) {
    synchronized (lockDatabases) {
        if (options.isReadOnly())
            mustExist = true;
        Database db = databases.get(name);
        if (db == null) {
            if (!isValidDatabaseName(name))
                throw new IllegalArgumentException("Invalid database name: " + name);
            String path = pathForDatabaseNamed(name);
            if (path == null)
                return null;
            db = new Database(path, name, this, options.isReadOnly());
            if (mustExist && !db.exists()) {
                Log.i(Database.TAG, "mustExist is true and db (%s) does not exist", name);
                return null;
            }
            db.setName(name);
            databases.put(name, db);
        }
        Log.v(Log.TAG_DATABASE, "getDatabase() %s %s", this, db);
        return db;
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:34,代码来源:Manager.java

示例6: setLogLevel

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private static void setLogLevel(int level) {
    Log.i(TAG, "Setting log level to '" + level + "'");

    Manager.enableLogging(Log.TAG, level);
    Manager.enableLogging(Log.TAG_SYNC, level);
    Manager.enableLogging(Log.TAG_QUERY, level);
    Manager.enableLogging(Log.TAG_VIEW, level);
    Manager.enableLogging(Log.TAG_CHANGE_TRACKER, level);
    Manager.enableLogging(Log.TAG_BLOB_STORE, level);
    Manager.enableLogging(Log.TAG_DATABASE, level);
    Manager.enableLogging(Log.TAG_LISTENER, level);
    Manager.enableLogging(Log.TAG_MULTI_STREAM_WRITER, level);
    Manager.enableLogging(Log.TAG_REMOTE_REQUEST, level);
    Manager.enableLogging(Log.TAG_ROUTER, level);
}
 
开发者ID:couchbaselabs,项目名称:react-native-couchbase-lite,代码行数:16,代码来源:ReactCBLite.java

示例7: findCommonAncestorOf

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public String findCommonAncestorOf(RevisionInternal rev, List<String> revIDs) {
    long generation = Revision.generationFromRevID(rev.getRevID());
    if (generation <= 1 || (revIDs == null || revIDs.size() == 0))
        return null;
    Collections.sort(revIDs, new Comparator<String>() {
        @Override
        public int compare(String id1, String id2) {
            // descending order of generation
            return RevisionInternal.CBLCompareRevIDs(id2, id1);
        }
    });
    Document doc = getDocument(rev.getDocID());
    if (doc == null)
        return null;
    String commonAncestor = null;
    try {
        for (String possibleRevID : revIDs) {
            if (Revision.generationFromRevID(possibleRevID) <= generation) {
                try {
                    if (doc.selectRevID(possibleRevID, false))
                        commonAncestor = possibleRevID;
                } catch (ForestException e) {
                    Log.i(TAG, "Error in Document.selectRevID() revID=%s", e, possibleRevID);
                }
                if (commonAncestor != null)
                    break;
            }
        }
    } finally {
        doc.free();
    }
    return commonAncestor;
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:35,代码来源:ForestDBStore.java

示例8: Manager

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @throws java.lang.SecurityException - Runtime exception that can be thrown by File.mkdirs()
 */
@InterfaceAudience.Public
public Manager(Context context, ManagerOptions options) throws IOException {
    Log.i(Database.TAG, "### %s ###", getFullVersionInfo());

    this.context = context;
    this.directoryFile = context.getFilesDir();
    this.options = (options != null) ? options : DEFAULT_OPTIONS;
    this.databases = new HashMap<String, Database>();
    this.encryptionKeys = new HashMap<String, Object>();
    this.replications = new ArrayList<Replication>();

    if (!directoryFile.exists()) {
        directoryFile.mkdirs();
    }
    if (!directoryFile.isDirectory()) {
        throw new IOException(String.format(Locale.ENGLISH, "Unable to create directory for: %s", directoryFile));
    }

    upgradeOldDatabaseFiles(directoryFile);

    // this must be a single threaded executor due to contract w/ Replication object
    // which must run on either:
    // - a shared single threaded executor
    // - its own single threaded executor
    workExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r, "CBLManagerWorkExecutor");
        }
    });
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:37,代码来源:Manager.java

示例9: clear

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public void clear() {
    try {
        getDb().putLocalDocument(COOKIE_LOCAL_DOC_NAME, null);
    } catch (CouchbaseLiteException e) {
        Log.i(Log.TAG_SYNC, "Unable to clear Cookies: Status=" + e.getCause(), e);
    }
    // Clear cookies from local store
    cookies.clear();
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:11,代码来源:PersistentCookieJar.java

示例10: stopListener

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@ReactMethod
public void stopListener() {
    Log.i(TAG, "Stopping CBL listener on port " + listener.getListenPort());
    listener.stop();
}
 
开发者ID:couchbaselabs,项目名称:react-native-couchbase-lite,代码行数:6,代码来源:ReactCBLite.java

示例11: doInBackground

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
protected UploadResult doInBackground(URL... params) {
    try {
        Log.i(TAG, "Uploading attachment '" + sourceUri + "' to '" + targetUri + "'");

        InputStream input;
        if (sourceUri.startsWith("/") || sourceUri.startsWith("file:/")) {
            String path = sourceUri.replace("file://", "/")
                    .replace("file:/", "/");
            File file = new File(path);

            input = new FileInputStream(file);
        } else if (sourceUri.startsWith("content://")) {
            input = ReactCBLite.this.context.getContentResolver().openInputStream(Uri.parse(sourceUri));
        } else {
            URLConnection urlConnection = new URL(sourceUri).openConnection();
            input = urlConnection.getInputStream();
        }

        try {
            HttpURLConnection conn = (HttpURLConnection) new URL(targetUri).openConnection();
            conn.setRequestProperty("Content-Type", contentType);
            conn.setRequestProperty("Authorization", authHeader);
            conn.setReadTimeout(100000);
            conn.setConnectTimeout(100000);
            conn.setRequestMethod(method);
            conn.setDoInput(true);
            conn.setDoOutput(true);

            OutputStream os = conn.getOutputStream();
            try {
                byte[] buffer = new byte[1024];
                int bytesRead;
                while ((bytesRead = input.read(buffer)) != -1) {
                    os.write(buffer, 0, bytesRead);
                    publishProgress(bytesRead);
                }
            } finally {
                os.close();
            }

            int responseCode = conn.getResponseCode();

            StringBuilder responseText = new StringBuilder();
            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            try {
                String line;
                while ((line = br.readLine()) != null) {
                    responseText.append(line);
                }
            } finally {
                br.close();
            }

            return new UploadResult(responseCode, responseText.toString());
        } finally {
            input.close();
        }
    } catch (Exception e) {
        Log.e(TAG, "Failed to save attachment", e);
        return new UploadResult(-1, "Failed to save attachment " + e.getMessage());
    }
}
 
开发者ID:couchbaselabs,项目名称:react-native-couchbase-lite,代码行数:64,代码来源:ReactCBLite.java


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