MTP: replace printfs with logcat
Change-Id: I2c30921098e2dc049dc5fc1e0a548ead33c363e0
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/media/mtp/MtpMediaScanner.cpp b/media/mtp/MtpMediaScanner.cpp
index 1db1b9d..ac4c0cf 100644
--- a/media/mtp/MtpMediaScanner.cpp
+++ b/media/mtp/MtpMediaScanner.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+#define LOG_TAG "MtpMediaScanner"
+
+#include "MtpDebug.h"
#include "MtpDatabase.h"
#include "MtpMediaScanner.h"
#include "mtp.h"
@@ -48,7 +51,7 @@
// returns true if it succeeded, false if an exception occured in the Java code
virtual bool scanFile(const char* path, long long lastModified, long long fileSize)
{
- printf("scanFile %s\n", path);
+ LOGV("scanFile %s", path);
return true;
}
@@ -88,7 +91,7 @@
if (sscanf(value, "%d", &temp) == 1)
mDuration = temp;
} else {
- printf("handleStringTag %s : %s\n", name, value);
+ LOGV("handleStringTag %s : %s", name, value);
}
return true;
}
@@ -104,7 +107,7 @@
// returns true if it succeeded, false if an exception occured in the Java code
virtual bool addNoMediaFolder(const char* path)
{
- printf("addNoMediaFolder %s\n", path);
+ LOGV("addNoMediaFolder %s", path);
return true;
}
@@ -180,7 +183,7 @@
for (int i = 0; i < mFileCount; i++) {
MtpObjectHandle test = mFileList[i];
if (! (test & kObjectHandleMarkBit)) {
- printf("delete missing file %08X\n", test);
+ LOGV("delete missing file %08X", test);
mDatabase->deleteFile(test);
}
}
@@ -260,12 +263,12 @@
unsigned length = strlen(path);
if (length > sizeof(buffer) + 2) {
- fprintf(stderr, "path too long: %s\n", path);
+ LOGE("path too long: %s", path);
}
DIR* dir = opendir(path);
if (!dir) {
- fprintf(stderr, "opendir %s failed, errno: %d", path, errno);
+ LOGE("opendir %s failed, errno: %d", path, errno);
return -1;
}
@@ -285,7 +288,7 @@
continue;
}
if (strlen(name) + 1 > fileNameLength) {
- fprintf(stderr, "path too long for %s\n", name);
+ LOGE("path too long for %s", name);
continue;
}
strcpy(fileStart, name);
@@ -327,7 +330,7 @@
handle = mDatabase->addFile(path, format, parent, mStorageID,
statbuf.st_size, statbuf.st_mtime);
if (handle <= 0) {
- fprintf(stderr, "addFile failed in MtpMediaScanner::scanFile()\n");
+ LOGE("addFile failed in MtpMediaScanner::scanFile()");
mDatabase->rollbackTransaction();
return;
}
@@ -371,7 +374,7 @@
return;
}
}
- fprintf(stderr, "file %d not found in mFileList\n", handle);
+ LOGE("file %d not found in mFileList", handle);
}
}