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


Scala Log类代码示例

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


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

示例1: PluginConfiguration

//设置package包名称以及导入依赖的类
package com.github.shadowsocks.plugin

import android.util.Log
import com.github.shadowsocks.utils.Commandline

import scala.collection.mutable


class PluginConfiguration(val pluginsOptions: Map[String, PluginOptions], val selected: String) {
  private def this(plugins: Array[PluginOptions]) =
    this(plugins.filter(_.id.nonEmpty).map(opt => opt.id -> opt).toMap, if (plugins.isEmpty) "" else plugins(0).id)
  def this(plugin: String) = this(if (plugin == null) Array[PluginOptions]() else plugin.split("\n").map {
    case line if line.startsWith("kcptun ") =>
      val opt = new PluginOptions()
      opt.id = "kcptun"
      try {
        val args = mutable.Queue(Commandline.translateCommandline(line): _*)
        args.dequeue()
        while (args.nonEmpty) args.dequeue() match {
          case "--nocomp" => opt.put("nocomp", null)
          case option if option.startsWith("--") => opt.put(option.substring(2), args.dequeue())
          case option => throw new IllegalArgumentException("Unknown kcptun parameter: " + option)
        }
      } catch {
        case exc: Exception => Log.w("PluginConfiguration", exc.getMessage)
      }
      opt
    case line => new PluginOptions(line)
  })

  def getOptions(id: String): PluginOptions = if (id.isEmpty) new PluginOptions() else pluginsOptions.get(id) match {
    case Some(options) => options
    case None => new PluginOptions(id, PluginManager.fetchPlugins()(id).defaultConfig)
  }
  def selectedOptions: PluginOptions = getOptions(selected)

  override def toString: String = {
    val result = new mutable.ListBuffer[PluginOptions]()
    for ((id, opt) <- pluginsOptions) id match {
      case this.selected => result.prepend(opt)
      case _ => result.append(opt)
    }
    if (!pluginsOptions.contains(selected)) result.prepend(selectedOptions)
    result.map(_.toString(false)).mkString("\n")
  }
} 
开发者ID:likky,项目名称:shadowsocks_android_build,代码行数:47,代码来源:PluginConfiguration.scala

示例2: DonaldTrump

//设置package包名称以及导入依赖的类
package com.github.shadowsocks.job

import android.util.Log
import com.evernote.android.job.JobCreator


object DonaldTrump extends JobCreator {
  def create(tag: String) = {
    val parts = tag.split(":")
    parts(0) match {
      case AclSyncJob.TAG => new AclSyncJob(parts(1))
      case _ =>
        Log.w("DonaldTrump", "Unknown job tag: " + tag)
        null
    }
  }
} 
开发者ID:RoomArchitect,项目名称:test0000,代码行数:18,代码来源:DonaldTrump.scala

示例3: DonaldTrump

//设置package包名称以及导入依赖的类
package com.github.shadowsocks.job

import android.util.Log
import com.evernote.android.job.JobCreator


object DonaldTrump extends JobCreator {
  def create(tag: String) = {
    val parts = tag.split(":")
    parts(0) match {
      case AclSyncJob.TAG => new AclSyncJob(parts(1))
      case SSRSubUpdateJob.TAG => new SSRSubUpdateJob()
      case _ =>
        Log.w("DonaldTrump", "Unknown job tag: " + tag)
        null
    }
  }
} 
开发者ID:wfjsw,项目名称:shadowsocksr-android-with-patches,代码行数:19,代码来源:DonaldTrump.scala

示例4: LogLogger

//设置package包名称以及导入依赖的类
package sgl.android.util

import sgl.util._

import android.util.Log


trait AndroidLoggingProvider extends LoggingProvider {

  import Logger._

  abstract class LogLogger extends Logger {
    override protected def log(level: LogLevel, tag: Tag, msg: String): Unit = level match {
      case NoLogging => ()
      case Error => Log.e(tag.name, msg)
      case Warning => Log.w(tag.name, msg)
      case Info => Log.i(tag.name, msg)
      case Debug => Log.d(tag.name, msg)
      case Trace => Log.v(tag.name, msg)
    }
  }
}


trait AndroidDefaultLoggingProvider extends AndroidLoggingProvider {
  case object DefaultLogLogger extends LogLogger {
    override val logLevel: Logger.LogLevel = Logger.Warning
  }
  override val logger = DefaultLogLogger
}

trait AndroidVerboseConsoleLoggingProvider extends AndroidLoggingProvider {
  case object VerboseLogLogger extends LogLogger {
    override val logLevel: Logger.LogLevel = Logger.Debug
  }
  override val logger = VerboseLogLogger
} 
开发者ID:regb,项目名称:scala-game-library,代码行数:38,代码来源:AndroidLoggingProvider.scala

示例5: WizardActivity

//设置package包名称以及导入依赖的类
package com.happyheal.happyhealapp.ui.wizard

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.happyheal.happyhealapp.{TypedFindView, TR}
import com.happyheal.happyhealapp.commons.ContextWrapperProvider
import com.happyheal.happyhealapp.modules.persistence.impl.PersistenceServicesComponentImpl
import com.happyheal.happyhealapp.ui.main.MainActivity
import macroid.{ContextWrapper, Contexts}
import macroid.FullDsl._


class WizardActivity
  extends AppCompatActivity
    with Contexts[AppCompatActivity]
    with ContextWrapperProvider
    with PersistenceServicesComponentImpl
    with TypedFindView
    with WizardComposer {

  override implicit lazy val contextProvider: ContextWrapper = activityContextWrapper

  val LOG_TAG = classOf[WizardActivity].getSimpleName

  override def onCreate(savedInstanceState: Bundle): Unit = {
    super.onCreate(savedInstanceState)
    Log.d(LOG_TAG, "WizardActivity")
    val extras = getIntent.getExtras
    val tutorialMode = if (extras != null) extras.getBoolean(WizardActivity.tutorialMode, false) else false
    if (!(tutorialMode || !persistenceServices.isWizardSeen)) {
      finish()
      startActivity(new Intent(getApplication, classOf[MainActivity]))
    }
    setContentView(TR.layout.wizard_layout.id)
    runUi(initializeWizard(tutorialMode))
  }

}

object WizardActivity {
  val tutorialMode = "tutorial_mode"
} 
开发者ID:pamu,项目名称:happyheal,代码行数:45,代码来源:WizardActivity.scala

示例6: ConfigView

//设置package包名称以及导入依赖的类
package fr.magistry.taigime2

import Message.Config

import android.content.Context
import android.util.Log
import android.view.{LayoutInflater, View}
import android.view.View.OnClickListener
import android.widget.{Button, CheckBox, Switch}





class ConfigView(context: Context, ime: TaigIME)  {
  val keyFuzzyLookup = "fuzzyLookup"
  val keyPojOrTL = "POJorTL"

  val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).asInstanceOf[LayoutInflater]
  val view = inflater.inflate(R.layout.config, null)
  val cbFuzzy = view.findViewById(R.id.cbFuzzy).asInstanceOf[CheckBox]
  val swRomanization = view.findViewById(R.id.swPOJTL).asInstanceOf[Switch]
  setValues()

  view
    .findViewById(R.id.acceptConfig)
    .asInstanceOf[Button]
    .setOnClickListener(new OnClickListener {
      override def onClick(v: View): Unit = {
        context.getSharedPreferences("TaigIME2",0)
          .edit()
          .putBoolean(keyFuzzyLookup, cbFuzzy.isChecked)
          .putBoolean(keyPojOrTL,swRomanization.isChecked)
          .apply()
        Log.v("IME","validate config")
        ime.message(Message.ConfigChanged(Config(cbFuzzy.isChecked, swRomanization.isChecked)))
        ime.message(Message.ChangeKeyboard)
      }
    })

  def setValues(): Unit = {
    val prefs = context.getSharedPreferences("TaigIME2", 0)
    val fuzzy = prefs.getBoolean(keyFuzzyLookup,true)
    val pojtr = prefs.getBoolean(keyPojOrTL, false)
    cbFuzzy.setChecked(fuzzy)
    swRomanization.setChecked(pojtr)
  }


} 
开发者ID:a-tsioh,项目名称:TaigIME2,代码行数:51,代码来源:ConfigView.scala


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