Question: I want to insert data if that headline doesn't exist yet in the database.

This is the error I'm getting for the written query:

> 
> near "with": syntax error (code 1): , while compiling: SELECT \* FROM movie WHERE headline=Albert Collen
> 
> 
> 

Code:

```
public boolean Insert(Item item) {
    SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    Cursor cursor = sqLiteDatabase.rawQuery("SELECT * FROM " + TABLE + " WHERE headline=" + item.getName() , null);

    if (cursor.moveToFirst()) {
    } else {
        contentValues.put("name", item.getName());           
        long result = sqLiteDatabase.insert(TABLE, null, contentValues);

        if (result == -1) {
            return false;
        } else {
            return true;
        }
    }

    cursor.close();
    sqLiteDatabase.close();

    return true;
}

```

Answer: 
You [control event formatting](https://github.com/serilog/serilog-sinks-file#controlling-event-formatting) either by specifying an output template string (as per your example) or by providing a custom `ITextFormatter` that does the formatting (example shown in the video you linked).

In your example, you can simply include `SourceContext` in the output template:

```
"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {Message:lj}{NewLine}{Exception}"

```

If you want all properties present in the log event (which would include `SourceContext`) you can use `{Properties}` instead:

```
"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Properties} {Message:lj}{NewLine}{Exception}"

```
Use this if you want it in a C# context. Note that multi-threading may be a consequent issue.

<https://gist.github.com/litetex/b88fe0531e5acea82df1189643fb1f79>