So it sounds like you just need the two patterns: access restrictions and Events. The first throws if the caller is not on some list. The second adds events to the contract's event log. So if you just had one single user your contract would look something like:
contract SomeContract {
//Assigned when contract is created so if you create it it is you
address public owner = msg.sender;
event LogAccessAttempt(address account, string function, uint timestamp); // Event
// This could be any function
function someFunction()
{
// Do logging
LogAccessAttempt(msg.sender,"someFunction",now);
//only allow the owner to call this function
if (msg.sender !=owner) throw;
// do something else
}
// You can assign ownership using this function
function changeOwner(address _newOwner)
{
LogAccessAttempt(msg.sender,"changeOwner",now);
//only allow the owner to call this function
if (msg.sender !=owner) throw;
owner = _newOwner;
}
}
As you have more functions this will probably get a little tedious so you could improve this by using modifiers and also you probably want multiple authorised accounts e.g
contract SomeContract {
mapping(address => bool) public users;
users[msg.sender]=true;
modifier guardAndLog(string msg )
{
LogAccessAttempt(msg.sender,msg,now);
if(!users[msg.sender])
throw
_;
}
function addUser(address _newUser)
guardAndLog("someone tried to add a user")
{
users[_newUser]=true
}
function someFunction()
guardAndLog("someone tried to access someFunction")
{
// Do something
}
}