From: Piotr Kosko
Date: Wed, 27 May 2015 12:07:22 +0000 (+0200)
Subject: [Filesystem] Added logs in methods onEntered and onReturn
X-Git-Tag: accepted/tizen/tv/20150615.001251^2~2^2~102
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14dc0957ab0fc1c597b4c2daf99d8ca217efb6d8;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Filesystem] Added logs in methods onEntered and onReturn
Change-Id: I15c04e54104a56de314b19a177fb495e12c3ad56
Signed-off-by: Piotr Kosko
---
diff --git a/src/filesystem/filesystem_file.cc b/src/filesystem/filesystem_file.cc
index eb810e5..386d4f7 100644
--- a/src/filesystem/filesystem_file.cc
+++ b/src/filesystem/filesystem_file.cc
@@ -64,6 +64,7 @@ bool validateCharacter(char c) {
*/
bool FilesystemBuffer::DecodeData(const std::string& data) {
+ LoggerD("Enter");
if (data.length() % 4) {
LoggerE("Buffer has invalid length");
return false;
@@ -120,6 +121,7 @@ bool FilesystemBuffer::DecodeData(const std::string& data) {
}
std::string FilesystemBuffer::EncodeData() const {
+ LoggerD("Enter");
std::string out;
for (size_t i = 0; i < size(); i += 3) {
@@ -152,6 +154,7 @@ FilesystemFile::FilesystemFile(const std::string& path_)
bool FilesystemFile::Read(FilesystemBuffer* data,
size_t offset,
size_t length) {
+ LoggerD("Enter");
if (!data) {
LoggerE("Missing output buffer");
return false;
@@ -204,6 +207,7 @@ bool FilesystemFile::Read(FilesystemBuffer* data,
}
bool FilesystemFile::Write(const FilesystemBuffer& data, size_t offset) {
+ LoggerD("Enter");
FILE* file = fopen(path.c_str(), "r+");
if (!file) {
LoggerE("Cannot open file %s to write!", path.c_str());
diff --git a/src/filesystem/filesystem_instance.cc b/src/filesystem/filesystem_instance.cc
index 15c121e..5190a0b 100644
--- a/src/filesystem/filesystem_instance.cc
+++ b/src/filesystem/filesystem_instance.cc
@@ -25,6 +25,7 @@ using namespace common;
using namespace extension::filesystem;
FilesystemInstance::FilesystemInstance() {
+ LoggerD("Enter");
using std::placeholders::_1;
using std::placeholders::_2;
@@ -357,6 +358,7 @@ void FilesystemInstance::FileSystemManagerFetchStorages(
void FilesystemInstance::StartListening(
const picojson::value& args,
picojson::object& out) {
+ LoggerD("enter");
FilesystemManager::GetInstance().StartListening();
ReportSuccess(out);
}
@@ -364,6 +366,7 @@ void FilesystemInstance::StartListening(
void FilesystemInstance::StopListening(
const picojson::value& args,
picojson::object& out) {
+ LoggerD("enter");
FilesystemManager::GetInstance().StopListening();
ReportSuccess(out);
}
@@ -381,6 +384,7 @@ void FilesystemInstance::onFilesystemStateChangeSuccessCallback(const common::Vi
}
void FilesystemInstance::onFilesystemStateChangeErrorCallback() {
+ LoggerD("enter");
picojson::value event = picojson::value(picojson::object());
picojson::object& obj = event.get();
ReportError(UnknownException(std::string("Failed to registerd listener")), obj);
diff --git a/src/filesystem/filesystem_manager.cc b/src/filesystem/filesystem_manager.cc
index f602101..58908cf 100644
--- a/src/filesystem/filesystem_manager.cc
+++ b/src/filesystem/filesystem_manager.cc
@@ -208,6 +208,7 @@ std::vector FilesystemManager::FillStorages() {
void FilesystemManager::FetchStorages(
const std::function&)>& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
auto result = FillStorages();
success_cb(result);
}
@@ -215,6 +216,7 @@ void FilesystemManager::FetchStorages(
FilesystemManager::FilesystemManager()
: listener_(nullptr), is_listener_registered_(false) {}
FilesystemManager::~FilesystemManager() {
+ LoggerD("enter");
if (is_listener_registered_) {
for (auto id : ids_) {
storage_unset_state_changed_cb(id, storage_cb);
@@ -223,6 +225,7 @@ FilesystemManager::~FilesystemManager() {
}
FilesystemManager& FilesystemManager::GetInstance() {
+ LoggerD("enter");
static FilesystemManager instance;
return instance;
}
@@ -232,6 +235,7 @@ void FilesystemManager::StatPath(
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
FilesystemStat statData = FilesystemStat::getStat(path);
if (!statData.valid) {
error_cb(statData.error);
@@ -244,6 +248,7 @@ void FilesystemManager::StatPath(
void FilesystemManager::GetVirtualRoots(
const std::function&)>& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
success_cb(common::VirtualFs::GetInstance().GetVirtualRoots());
}
@@ -251,6 +256,7 @@ void FilesystemManager::CreateFile(
const std::string& path,
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
const mode_t create_mode = S_IRWXU | S_IRWXG | S_IRWXO;
int status;
status =
@@ -286,6 +292,7 @@ void FilesystemManager::Rename(
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
int status = rename(oldPath.c_str(), newPath.c_str());
if (0 == status) {
FilesystemStat fileStat = FilesystemStat::getStat(newPath);
@@ -338,6 +345,7 @@ void FilesystemManager::UnlinkFile(
const std::string& path,
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
if (unlink(path.c_str()) != 0) {
LoggerE("Error occured while deleting file");
error_cb(FilesystemError::Other);
@@ -350,6 +358,7 @@ void FilesystemManager::RemoveDirectory(
const std::string& path,
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
const int maxDirOpened = 64;
if (nftw(path.c_str(), unlink_cb, maxDirOpened, FTW_DEPTH | FTW_PHYS) != 0) {
LoggerE("Error occured");
@@ -366,6 +375,7 @@ void FilesystemManager::FileRead(
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
FilesystemFile file(path);
FilesystemBuffer buffer;
if (!file.Read(&buffer, offset, length)) {
@@ -385,6 +395,7 @@ void FilesystemManager::FileWrite(
const std::function& success_cb,
const std::function& error_cb) {
+ LoggerD("enter");
FilesystemFile file(path);
FilesystemBuffer buffer;
// Decode buffer data
@@ -450,6 +461,7 @@ void FilesystemManager::CopyTo(
if (FilesystemError::None == retval) {
success_cb();
} else {
+ LoggerE("Failed: perform_deep_copy()");
error_cb(retval);
}
}
diff --git a/src/filesystem/filesystem_stat.cc b/src/filesystem/filesystem_stat.cc
index ce919bf..486fc36 100644
--- a/src/filesystem/filesystem_stat.cc
+++ b/src/filesystem/filesystem_stat.cc
@@ -17,6 +17,7 @@ namespace filesystem {
FilesystemStat::FilesystemStat() : error(FilesystemError::None), valid(false) {}
picojson::value FilesystemStat::toJSON() const {
+ LoggerD("Enter");
picojson::value retval = picojson::value(picojson::object());
picojson::object& obj = retval.get();
@@ -33,6 +34,7 @@ picojson::value FilesystemStat::toJSON() const {
}
FilesystemStat FilesystemStat::getStat(const std::string& path) {
+ LoggerD("Enter");
struct stat aStatObj;
FilesystemStat _result;
diff --git a/src/filesystem/filesystem_utils.cc b/src/filesystem/filesystem_utils.cc
index 59bae29..71e032c 100644
--- a/src/filesystem/filesystem_utils.cc
+++ b/src/filesystem/filesystem_utils.cc
@@ -9,6 +9,7 @@
namespace FilesystemUtils {
std::string get_storage_dir_path(int id, storage_directory_e typeToCheck) {
+ LoggerD("Enter");
int result = STORAGE_ERROR_NONE;
char* platformPath = NULL;
result = storage_get_directory(id, typeToCheck, &platformPath);