패키지, 저장소 및 앱 카테고리 검색

패키지 상세v5.0.1

l

간단한 API를 갖춘 크로스 플랫폼 html/io 로거 라이브러리입니다. 네이티브 및 웹 콘솔에서 조작할 수 있습니다. ASCII 색상 출력을 지원합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.2천
좋아요
93
Pub 점수
160

패키지 설치

flutter pub add l

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

'l' 패키지는 플러터용 크로스플랫폼 로깅 라이브러리로, 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스에서 메시지를 로깅하기 위한 간단한 API를 제공합니다. 네이티브 및 웹 콘솔을 통해 출력 조작을 지원하며, 로그의 가독성을 향상시키기 위해 내장된 ASCII 색상화 기능을 갖추고 있습니다. 디버깅과 실시간 애플리케이션 동작 모니터링에 이상적이며, 복잡성을 추가하지 않고 개발 워크플로우에 원활하게 통합됩니다. 개발자가 일관성 있고 색다르며 플랫폼 독립적인 로깅이 필요할 때 최적의 선택입니다.

사용 사례

  • 다중 플랫폼에서 실시간 디버깅
  • 더 나은 로그 가시성을 위한 색상화된 콘솔 출력
  • 개발 및 테스트에서의 간단한 통합
  • 다중 플랫폼 로깅 일관성
  • 개발 중 앱 동작 모니터링
  • 웹 및 모바일 앱을 동시에 디버깅하기

주요 기능

  • 간단하고 직관적인 API
  • ASCII 색상 출력
  • 모든 주요 Flutter 플랫폼을 지원합니다
  • 네이티브 및 웹 콘솔 호환성
  • 경량이고 빠름
  • flutter pub add로 간편 설정

적합한 대상

  • 간편한 로깅을 원하는 플러터 개발자
  • 다중 플랫폼 앱을 개발하는 팀
  • 디버깅 효율에 집중하는 개발자
  • 색상이 있는 콘솔 출력을 필요로 하는 프로젝트
  • 최소한의 보일러플레이트 로깅을 원하는 사람
  • 프론트엔드 및 백엔드 디버그 로깅

고려 사항

  • 생산 로깅을 위한 것이 아님
  • 색 출력이 모든 환경에서 렌더링되지 않을 수 있습니다
  • 제한된 구성 옵션
  • 개발용으로 가장 적합
  • 대규모 앱에서는 추가 필터링이 필요할 수 있습니다
  • 콘솔 사용 가능 여부에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

[L]ogger

Pub Actions Status Coverage License: MIT Linter GitHub stars

About

Cross-platform html/io logger with simple API. No need to create a logger object. Just import and use. Simple and w/o boilerplate. Work with native console.

Core API

Example of usage

Example of using the library to display a message in the console.

Key features
Method Description
[s] A shout is always displayed
[v1], [v] Regular message with verbose level 1
[e] Error message with verbose level 1
[v2], [vv] Regular message with verbose level 2
[w] Warning message with verbose level 2
[v3], [vvv] Regular message with verbose level 3
[i], [<] Inform message with verbose level 3
[v4], [vvvv] Regular message with verbose level 4
[d], [<<] Debug message with verbose level 4
[v5], [vvvvv] Regular message with verbose level 5
[v6], [vvvvvv] Regular message with verbose level 6
l.s('shout me');
l.e('error msg');
l.w('warning msg');
l.i('info msg');
l < 'alt info msg';
l.d('debug msg');
l << 'alt debug msg';
l.v('verbose lvl #1');
l.vv('verbose lvl #2');
l.vvv('verbose lvl #3');
l.v4('verbose lvl #4');
l.v5('verbose lvl #5');
l.v6('verbose lvl #6');
Integration capabilities
Method Description
[listen] Broadcast stream receiving logs.
// Broadcast stream instantly receiving logs.
l.forEach((log) => print('* ${log.level} : ${log.message}'));
Print handling and customizing

Logger supports fine-tuning with the second argument LogOptions in a capture method. Also, you can handle print and output with l on some function or in a whole app with this simple syntax:

import 'package:l/l.dart';

void main() => l.capture(
      someFunction,
      const LogOptions(
        handlePrint: true,
        printColors: true,
        outputInRelease: false,
        messageFormatting: _messageFormatting,
      ),
    );

Future<void> someFunction() async {
  print('Hello');
  await Future<void>.delayed(const Duration(milliseconds: 150));
  l.d('world');
  await Future<void>.delayed(const Duration(milliseconds: 150));
  l.e('!!!');
}

Object _messageFormatting(Object message, LogLevel logLevel, DateTime now) =>
    '${now.hour}:${now.minute.toString().padLeft(2, '0')} $message';

Handling errors

Flutter
final sourceFlutterError = FlutterError.onError;
FlutterError.onError = (details) {
  l.w(details.exceptionAsString(), details.stack);
  sourceFlutterError?.call(details);
};
Crashlytics
l.where((msg) => msg.level.maybeWhen(
      error: () => true,
      warning: () => true,
      orElse: () => false,
    ))
  .map<String>((msg) => msg.message.toString())
  .listen(FirebaseCrashlytics.instance.log);
Zoned Errors
runZonedGuarded(someFunction, l.e);
Handling uncaught errors
Isolate.current
       ..setErrorsFatal(false)
       ..addErrorListener(
         RawReceivePort(
           (List<dynamic> pair) => // ignore: avoid_types_on_closure_parameters
               l.e(pair.first as Object),
         ).sendPort,
       );

Limitations

  • When there is no direct access to the terminal, it works through print.
  • !!! PLEASE, DO NOT LOG SENSITIVE INFORMATION !!!

Changelog

Refer to the Changelog to get all release notes.

Maintainers

Plague Fox

Funding

If you want to support the development of our library, there are several ways you can do it:

We appreciate any form of support, whether it's a financial donation or just a star on GitHub. It helps us to continue developing and improving our library. Thank you for your support!

License

MIT

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.