MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / console_get

Function console_get

unity_cli/cli/commands/console.py:74–138  ·  view source on GitHub ↗

Get console logs. Level hierarchy: L (log) < W (warning) < E (error) < X (exception) Examples: u console get # All logs (plain text) u console get --json # All logs (JSON format) u console get -s # All logs with stack traces u co

(
    ctx: typer.Context,
    level: Annotated[
        str | None,
        typer.Option(
            "--level",
            "-l",
            help="Log level filter: L(log), W(warning), E(error), X(exception). "
            "E.g., '-l W' for warning+, '-l +E' for error only",
        ),
    ] = None,
    count: Annotated[
        int | None,
        typer.Option("--count", "-c", hidden=True, help="[Deprecated] Use: u console get | head -N"),
    ] = None,
    filter_text: Annotated[
        str | None,
        typer.Option("--filter", "-f", hidden=True, help="[Deprecated] Use: u console get | grep PATTERN"),
    ] = None,
    stacktrace: Annotated[
        bool,
        typer.Option("--stacktrace", "-s", help="Include stack traces in output"),
    ] = False,
    verbose_legacy: Annotated[
        bool,
        typer.Option("--verbose", "-v", hidden=True, help="[Deprecated] Use --stacktrace/-s"),
    ] = False,
    json_flag: Annotated[
        bool,
        typer.Option("--json", help="Output as JSON"),
    ] = False,
)

Source from the content-addressed store, hash-verified

72
73@console_app.command("get")
74def console_get(
75 ctx: typer.Context,
76 level: Annotated[
77 str | None,
78 typer.Option(
79 "--level",
80 "-l",
81 help="Log level filter: L(log), W(warning), E(error), X(exception). "
82 "E.g., '-l W' for warning+, '-l +E' for error only",
83 ),
84 ] = None,
85 count: Annotated[
86 int | None,
87 typer.Option("--count", "-c", hidden=True, help="[Deprecated] Use: u console get | head -N"),
88 ] = None,
89 filter_text: Annotated[
90 str | None,
91 typer.Option("--filter", "-f", hidden=True, help="[Deprecated] Use: u console get | grep PATTERN"),
92 ] = None,
93 stacktrace: Annotated[
94 bool,
95 typer.Option("--stacktrace", "-s", help="Include stack traces in output"),
96 ] = False,
97 verbose_legacy: Annotated[
98 bool,
99 typer.Option("--verbose", "-v", hidden=True, help="[Deprecated] Use --stacktrace/-s"),
100 ] = False,
101 json_flag: Annotated[
102 bool,
103 typer.Option("--json", help="Output as JSON"),
104 ] = False,
105) -> None:
106 """Get console logs.
107
108 Level hierarchy: L (log) < W (warning) < E (error) < X (exception)
109
110 Examples:
111 u console get # All logs (plain text)
112 u console get --json # All logs (JSON format)
113 u console get -s # All logs with stack traces
114 u console get -l E # Error and above (error + exception)
115 u console get -l W # Warning and above
116 u console get -l +W # Warning only
117 u console get -l +E+X # Error and exception only
118 """
119 context: CLIContext = ctx.obj
120
121 include_stacktrace = stacktrace or verbose_legacy
122 _warn_deprecated_console_opts(verbose_legacy, count, filter_text)
123
124 try:
125 types = _parse_level(level) if level else None
126 result = context.client.console.get(
127 types=types,
128 count=count,
129 filter_text=filter_text,
130 include_stacktrace=include_stacktrace,
131 )

Callers

nothing calls this directly

Calls 7

_should_jsonFunction · 0.90
print_jsonFunction · 0.90
_handle_errorFunction · 0.90
_parse_levelFunction · 0.85
_print_console_entriesFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected