Skip to content

Commit

Permalink
ubuntu-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
lol768 committed Nov 21, 2023
1 parent 4239057 commit fff1021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu
runs-on: ubuntu-latest
name: Build
steps:
# Checkout
Expand Down
5 changes: 2 additions & 3 deletions src/Raileasy.Serilog.Stackdriver/StackdriverJsonFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ namespace Raileasy.Serilog.Stackdriver
public class StackdriverJsonFormatter : ITextFormatter
{
// 256kb apparently, but we're conservative (https://cloud.google.com/logging/quotas)
private static readonly int STACKDRIVER_ENTRY_LIMIT_BYTES = 200 * 1024; // 258kb, reduced to 200kb
private const int StackdriverEntryLimitBytes = 200 * 1024; // 258kb, reduced to 200kb

private readonly bool _checkForPayloadLimit;
private readonly bool _includeMessageTemplate;
private readonly JsonValueFormatter _valueFormatter;

public StackdriverJsonFormatter(bool checkForPayloadLimit = true,
bool includeMessageTemplate = true,
JsonValueFormatter valueFormatter = null)
Expand Down Expand Up @@ -136,7 +135,7 @@ public void FormatEvent(LogEvent logEvent, TextWriter originalOutput, JsonValueF

// if we have blown the limit of a single stackdriver line (which means that error reporting won't parse
// it correctly for instance) - then log that fact out too so we can adjust the logging and fix the problem
if (_checkForPayloadLimit && (output.CharacterCount * 4) >= STACKDRIVER_ENTRY_LIMIT_BYTES)
if (_checkForPayloadLimit && (output.CharacterCount * 4) >= StackdriverEntryLimitBytes)
{
string text = "An attempt was made to write a log event to stackdriver that exceeds StackDriver Entry length limit - check logs for partially parsed entry just prior to this and fix at source";
var tooLongLogEvent = new LogEvent(
Expand Down

0 comments on commit fff1021

Please sign in to comment.