-
-
Notifications
You must be signed in to change notification settings - Fork 3
Logging
IN DEVELOPMENT
Automatic logging is included. It can be enabled by adding the appropriate AppSettings keys:
-
Cardknox.Logging
:enabled
-
Cardknox.LogLocation
:~/App_Data/Log/cardknox_{0:MMddyyyy}.log
The Cardknox.LogLocation
key can be app-specific by prepending the ~
character or it can be absolute by omitting it.
-
Cardknox.LogLocation
:/var/log/cardknox/{0:MMddyyyy}.log
-
Cardknox.LogLocation
:C:\Temp\Cardknox\{0:MMddyyyy}.log
If installing from NuGet, the System.Configuration.ConfigurationManager
package will be added automatically. If installing from source or from the GitHub release, you'll need to install this package yourself.
The sensitive card information (xCardNum
, xCVV
, xExp
, xMagStripe
, etc) will not be included for PCI compliance reasons.
It is possible, beginning in 3.0.2-beta, to implement your own custom logging through the use of the RequestStarted
and RequestCompleted
event handlers. Using either of these will override and replace the internal logging for whichever event is implemented. If implementing both of these events, it will not be necessary to add the keys to AppSettings
.
When implemented, it will look similar to the following:
using CardknoxApi;
using CardknoxApi.Operations;
public static void Main()
{
Cardknox c = new Cardknox(new CardknoxRequest("", "", ""));
c.RequestStarted += C_RequestStarted;
c.RequestCompleted += C_RequestCompleted;
CardknoxResponse resp = c.CCRefund(new CCRefund());
}
private void C_RequestStarted(object sender, CardknoxEventArgs e)
{
// .. custom logging to file or database
}
private void C_RequestCompleted(object sender, CardknoxEventArgs e)
{
// .. custom logging to file or database
}
CardknoxEventArgs
contains the property Results
which is a ReadOnlyDictionary<string, string>
and is a copy of the data sent to/received from the Cardknox API. The sensitive card information (xCardNum
, xCVV
, xExp
, xMagStripe
, etc) will not be included for PCI compliance reasons.