LogUtil
public class LogUtil
extends Object
java.lang.object |
↳ | com.android.tradefed.log.LogUtil |
کلاس ابزار ورود به سیستم. برای کدهایی که نیاز به لغو روش های استاتیک از Log
دارند مفید است
خلاصه
کلاس های تو در تو |
---|
class | LogUtil.CLog یک کلاس شیم برای Log که به طور خودکار از نام کلاس ساده تماس گیرنده به عنوان تگ گزارش استفاده می کند |
روش های عمومی |
---|
static String | getLogFormatString (Log.LogLevel logLevel, String tag, String message) یک رشته فرمت شبیه به فرمت گزارش "threadtime" در دستگاه ایجاد می کند. |
static void | printLog (Log.LogLevel logLevel, String tag, String message) زمانی ارسال می شود که یک پیام گزارش باید چاپ شود. |
روش های عمومی
public static String getLogFormatString (Log.LogLevel logLevel,
String tag,
String message)
یک رشته فرمت شبیه به فرمت گزارش "threadtime" در دستگاه ایجاد می کند. این به طور خاص مفید است زیرا شامل روز و ماه است (برای متمایز کردن زمان برای نمونههای طولانی مدت TF)، و همچنین از زمان 24 ساعته برای ابهامزدایی صبح از عصر استفاده میکند.
پارامترها |
---|
logLevel | Log.LogLevel |
tag | String |
message | String |
printLog
public static void printLog (Log.LogLevel logLevel,
String tag,
String message)
زمانی ارسال می شود که یک پیام گزارش باید چاپ شود. این پیاده سازی پیام را در همه موارد به stdout چاپ می کند.
پارامترها |
---|
logLevel | Log.LogLevel : فهرست LogLevel که نشان دهنده اولویت پیام است. |
tag | String : برچسب مرتبط با پیام. |
message | String : پیامی که باید نمایش داده شود. |
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# LogUtil\n=======\n\n\n`\npublic\n\n\nclass\nLogUtil\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|----------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.log.LogUtil |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA logging utility class. Useful for code that needs to override static methods from [Log](../../../../../../reference/tradefed/com/android/tradefed/log/Log.html)\n\nSummary\n-------\n\n| ### Nested classes ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` class` | [LogUtil.CLog](../../../../../../reference/tradefed/com/android/tradefed/log/LogUtil.CLog.html) A shim class for [Log](../../../../../../reference/tradefed/com/android/tradefed/log/Log.html) that automatically uses the simple classname of the caller as the log tag |\n\n| ### Public methods ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static String` | ` `[getLogFormatString](../../../../../../reference/tradefed/com/android/tradefed/log/LogUtil.html#getLogFormatString(com.android.ddmlib.Log.LogLevel,%20java.lang.String,%20java.lang.String))`(Log.LogLevel logLevel, String tag, String message) ` Creates a format string that is similar to the \"threadtime\" log format on the device. |\n| ` static void` | ` `[printLog](../../../../../../reference/tradefed/com/android/tradefed/log/LogUtil.html#printLog(com.android.ddmlib.Log.LogLevel,%20java.lang.String,%20java.lang.String))`(Log.LogLevel logLevel, String tag, String message) ` Sent when a log message needs to be printed. |\n\nPublic methods\n--------------\n\n### getLogFormatString\n\n```\npublic static String getLogFormatString (Log.LogLevel logLevel, \n String tag, \n String message)\n```\n\nCreates a format string that is similar to the \"threadtime\" log format on the device. This\nis specifically useful because it includes the day and month (to differentiate times for\nlong-running TF instances), and also uses 24-hour time to disambiguate morning from evening.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------|\n| `logLevel` | `Log.LogLevel` \u003cbr /\u003e |\n| `tag` | `String` \u003cbr /\u003e |\n| `message` | `String` \u003cbr /\u003e |\n\n| Returns ||\n|----------|--------|\n| `String` | \u003cbr /\u003e |\n\n**See also:**\n\n- [Log.getLogFormatString(LogLevel, String, String)](../../../../../../reference/tradefed/com/android/tradefed/log/Log.html#getLogFormatString(com.android.tradefed.log.Log.LogLevel,%20java.lang.String,%20java.lang.String)) \n\n### printLog\n\n```\npublic static void printLog (Log.LogLevel logLevel, \n String tag, \n String message)\n```\n\nSent when a log message needs to be printed. This implementation prints the message to\nstdout in all cases.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `logLevel` | `Log.LogLevel`: The [LogLevel](../../../../../../reference/tradefed/com/android/ddmlib/Log.LogLevel.html) enum representing the priority of the message. \u003cbr /\u003e |\n| `tag` | `String`: The tag associated with the message. \u003cbr /\u003e |\n| `message` | `String`: The message to display. \u003cbr /\u003e |"]]