Step 1: Simplify the trigonometric expression.
We need to evaluate
\[
I=\int \frac{dx}{\sin\left(x-\frac{\pi}{3}\right)\cos x}
\]
Using the identity
\[
\sin(A-B)=\sin A\cos B-\cos A\sin B
\]
we get
\[
\sin\left(x-\frac{\pi}{3}\right)
=
\sin x\cos\frac{\pi}{3}-\cos x\sin\frac{\pi}{3}
\]
\[
=
\frac{1}{2}\sin x-\frac{\sqrt{3}}{2}\cos x
\]
\[
=
\frac{1}{2}\left(\sin x-\sqrt{3}\cos x\right)
\]
Therefore,
\[
\sin\left(x-\frac{\pi}{3}\right)\cos x
=
\frac{1}{2}\left(\sin x-\sqrt{3}\cos x\right)\cos x
\]
Step 2: Rewrite the integral.
So,
\[
I=\int \frac{dx}{\frac{1}{2}\left(\sin x-\sqrt{3}\cos x\right)\cos x}
\]
\[
I=2\int \frac{dx}{\left(\sin x-\sqrt{3}\cos x\right)\cos x}
\]
Divide numerator and denominator inside the expression by \(\cos^2x\).
Since,
\[
\sin x=\tan x\cos x
\]
we have
\[
\sin x-\sqrt{3}\cos x
=
\cos x(\tan x-\sqrt{3})
\]
Thus,
\[
\left(\sin x-\sqrt{3}\cos x\right)\cos x
=
\cos^2x(\tan x-\sqrt{3})
\]
Therefore,
\[
I=2\int \frac{dx}{\cos^2x(\tan x-\sqrt{3})}
\]
Since,
\[
\frac{1}{\cos^2x}=\sec^2x
\]
we get
\[
I=2\int \frac{\sec^2x}{\tan x-\sqrt{3}}\,dx
\]
Step 3: Substitute \(t=\tan x-\sqrt{3}\).
Let
\[
t=\tan x-\sqrt{3}
\]
Then,
\[
dt=\sec^2x\,dx
\]
So,
\[
I=2\int \frac{dt}{t}
\]
\[
I=2\log|t|+C
\]
Substituting back,
\[
I=2\log|\tan x-\sqrt{3}|+C
\]
This can also be written as
\[
I=2\log\left|\frac{\tan x-\sqrt{3}}{2}\right|+C
\]
because
\[
2\log 2
\]
can be absorbed in the constant \(C\).
Step 4: Match with the options.
The matching option is
\[
2\log\left(\frac{\tan x-\sqrt{3}}{2}\right)+C
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{2\log\left(\frac{\tan x-\sqrt{3}}{2}\right)+C}
\]