jsgoupil / quickbooks-sync

Sync Quickbooks Desktop
MIT License
87 stars 40 forks source link

Error always logged on sync complete #17

Closed bzbetty closed 8 years ago

bzbetty commented 8 years ago

We get a an error logged each sync with the message

[QBError] Out - {KEY} Sync Completed

trying to find out if there actually an error occuring that we need to fix, or if this should be an informational message instead of an error.

jsgoupil commented 8 years ago

@bzbetty Sorry but this seems to be your code logic? Is this coming from your LogMessage ?

bzbetty commented 8 years ago

I'm looking at line 406 of the Sync Manager

https://github.com/jsgoupil/quickbooks-sync/blob/1f795169ee32d7e453422dc689eb0edd13852da4/src/WebConnector/SyncManager.cs#L406

jsgoupil commented 8 years ago

I'm not sure what the problem is? LogMessage does not mean an error happened. LogMessage is called for anything going in or out the API.

bzbetty commented 8 years ago

The LogMessage is called with LogMessageType.Error, just means every completion is coming up in my logs as an error and not an info/debug message.

LogMessage(authenticatedTicket, LogMessageType.Error, LogDirection.Out, ticket, result);

jsgoupil commented 8 years ago

Ah you are right. I misread that... sorry! It should definitely not be logged as an error. Thanks for pointing this out!

jsgoupil commented 8 years ago

I think this would fix it:

try
{
    LogMessage(authenticatedTicket, LogMessageType.Close, LogDirection.In, ticket);

    var logMessageType = LogMessageType.Error;
    var result = "Invalid Ticket";

    if (authenticatedTicket != null)
    {
        result = "Sync Completed";
        logMessageType = LogMessageType.Close;
    }

    LogMessage(authenticatedTicket, logMessageType, LogDirection.Out, ticket, result);

    return result;
}
bzbetty commented 8 years ago

yeah that looks much better. thanks.