#include <acsDaemonUtils.h>

Public Member Functions | |
| AcsDaemonUtils () | |
| std::string | getLogDirectory () |
| std::string | getLogDirectoryForContainer (std::string containerName) |
| std::string | getTimestamp () |
| std::string | getSimpleContainerName (std::string containerName) |
| int | checkWritePermission () |
| int | checkWritePermissionForContainer (std::string containerName) |
Private Member Functions | |
| int | initLogDirectory () |
| bool | makeFolder (std::string path) |
| int | checkWritePermission (std::string folder) |
Private Attributes | |
| std::string | m_logDirectory |
| AcsDaemonUtils::AcsDaemonUtils | ( | ) |
Constructor
| int AcsDaemonUtils::checkWritePermission | ( | ) |
Check if the process has permission to write in the log folder where the log folder is returned by getLogDirectory()
| int AcsDaemonUtils::checkWritePermission | ( | std::string | folder | ) | [private] |
Check if the process has permission to write in the passed log folder.
The test is done by creating a temporary file as this should be the most portable way.
| int AcsDaemonUtils::checkWritePermissionForContainer | ( | std::string | containerName | ) |
Check if the process has permission to write in the log folder for the passed container name. The folder for the logs of container is built by AcsDaemonUtils::getLogDirectoryForContainer(...)
| std::string AcsDaemonUtils::getLogDirectory | ( | ) | [inline] |
Get the directory to write the log files into.
References m_logDirectory.
| std::string AcsDaemonUtils::getLogDirectoryForContainer | ( | std::string | containerName | ) |
The folder for the logs of a container is usually $ACSDATA/logs/<HOST>. If the container is hierarchical i.e it has a name like CONTROL/ACC/containerName then the logs go in $ACSDATA/logs/<HOST>/CONTROL/ACC/
If the folder does not exist, this method tries to build the folder setting the permissions too.
In case of error building the folder, it returns m_logDirectory.
| containerName | The name of the container |
| std::string AcsDaemonUtils::getSimpleContainerName | ( | std::string | containerName | ) |
Return the container name without the hierarchical part, that is:
| std::string AcsDaemonUtils::getTimestamp | ( | ) |
Build a return a well formatted timestamp
| int AcsDaemonUtils::initLogDirectory | ( | ) | [private] |
Init the log directory, m_logDirectory, from the ACSDATA environment variable, if defined.
If the folder does not exist, then initLogDirectory tries to create .
Note that this is the base folder for the logs i.e. ACSDATA/logs/host.
| bool AcsDaemonUtils::makeFolder | ( | std::string | path | ) | [private] |
Make the folder with the passed path.
| path | The path of the folder to create |
std::string AcsDaemonUtils::m_logDirectory [private] |
The directory to write the logs.
Referenced by getLogDirectory().
1.7.0